Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
39d6816a
Commit
39d6816a
authored
4 years ago
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
neighbor/upnp: roll back changes if DoOpen() fails
parent
6517b2d2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
11 deletions
+26
-11
UdisksNeighborPlugin.cxx
src/neighbor/plugins/UdisksNeighborPlugin.cxx
+26
-11
No files found.
src/neighbor/plugins/UdisksNeighborPlugin.cxx
View file @
39d6816a
...
...
@@ -113,22 +113,37 @@ UdisksNeighborExplorer::DoOpen()
auto
&
connection
=
GetConnection
();
/* this ugly try/catch cascade is only here because this
method has no RAII for this method - TODO: improve this */
try
{
Error
error
;
dbus_bus_add_match
(
connection
,
udisks_neighbor_match
,
error
);
error
.
CheckThrow
(
"DBus AddMatch error"
);
dbus_connection_add_filter
(
connection
,
HandleMessage
,
this
,
nullptr
);
auto
msg
=
Message
::
NewMethodCall
(
UDISKS2_INTERFACE
,
UDISKS2_PATH
,
DBUS_OM_INTERFACE
,
"GetManagedObjects"
);
list_request
.
Send
(
connection
,
*
msg
.
Get
(),
std
::
bind
(
&
UdisksNeighborExplorer
::
OnListNotify
,
this
,
std
::
placeholders
::
_1
));
try
{
dbus_connection_add_filter
(
connection
,
HandleMessage
,
this
,
nullptr
);
try
{
auto
msg
=
Message
::
NewMethodCall
(
UDISKS2_INTERFACE
,
UDISKS2_PATH
,
DBUS_OM_INTERFACE
,
"GetManagedObjects"
);
list_request
.
Send
(
connection
,
*
msg
.
Get
(),
std
::
bind
(
&
UdisksNeighborExplorer
::
OnListNotify
,
this
,
std
::
placeholders
::
_1
));
}
catch
(...)
{
dbus_connection_remove_filter
(
connection
,
HandleMessage
,
this
);
throw
;
}
}
catch
(...)
{
dbus_bus_remove_match
(
connection
,
udisks_neighbor_match
,
nullptr
);
throw
;
}
}
catch
(...)
{
dbus_glue
.
Destruct
();
throw
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment