Skip to content

Commit

Permalink
Deal with dbus_connection_send_with_reply() returning NULL pending call
Browse files Browse the repository at this point in the history
It is possible for dbus_connection_send_with_reply() to report no
failure, but still return NULL pending call object - for example if
the connection is in disconnected state - and thus we need to check
for this separately.
  • Loading branch information
spiiroin committed Jan 21, 2014
1 parent 3fb550a commit fd90f36
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mce-sensorfw.c
Expand Up @@ -1987,6 +1987,9 @@ static gboolean xsensord_get_name_owner(void)
if( !dbus_connection_send_with_reply(systembus, req, &pc, -1) )
goto EXIT;

if( !pc )
goto EXIT;

if( !dbus_pending_call_set_notify(pc, xsensord_get_name_owner_cb, 0, 0) )
goto EXIT;

Expand Down
3 changes: 3 additions & 0 deletions modules/battery-upower.c
Expand Up @@ -822,6 +822,9 @@ static void xup_properties_get_all(const char *path)
if( !dbus_connection_send_with_reply(bus, req, &pc, -1) )
goto EXIT;

if( !pc )
goto EXIT;

if( !dbus_pending_call_set_notify(pc, xup_properties_get_all_cb,
strdup(path), free) )
goto EXIT;
Expand Down
5 changes: 5 additions & 0 deletions modules/cpu-keepalive.c
Expand Up @@ -557,6 +557,11 @@ cpu_keepalive_verify_name(const char *name)
goto EXIT;
}

if( !pc )
{
goto EXIT;
}

key = g_strdup(name);

if( !dbus_pending_call_set_notify(pc, cpu_keepalive_verify_name_cb,
Expand Down
6 changes: 6 additions & 0 deletions modules/display.c
Expand Up @@ -3773,6 +3773,9 @@ static gboolean mdy_renderer_set_state_req(renderer_state_t state)
mdy_renderer_ipc_timeout) )
goto EXIT;

if( !mdy_renderer_set_state_pc )
goto EXIT;

if( !dbus_pending_call_set_notify(mdy_renderer_set_state_pc,
mdy_renderer_set_state_cb,
GINT_TO_POINTER(state), 0) )
Expand Down Expand Up @@ -5333,6 +5336,9 @@ mdy_nameowner_query_req(const char *name)
if( !dbus_connection_send_with_reply(mdy_nameowner_bus, req, &pc, -1) )
goto EXIT;

if( !pc )
goto EXIT;

key = strdup(name);

if( !dbus_pending_call_set_notify(pc, mdy_nameowner_query_rsp, key, free) )
Expand Down
9 changes: 9 additions & 0 deletions modules/radiostates.c
Expand Up @@ -649,6 +649,9 @@ static gboolean xconnman_set_property_bool(const char *key, gboolean val)
if( !dbus_connection_send_with_reply(connman_bus, req, &pc, -1) )
goto EXIT;

if( !pc )
goto EXIT;

if( !dbus_pending_call_set_notify(pc, xconnman_set_property_cb, 0, 0) )
goto EXIT;

Expand Down Expand Up @@ -844,6 +847,9 @@ static gboolean xconnman_get_properties(void)
if( !dbus_connection_send_with_reply(connman_bus, req, &pc, -1) )
goto EXIT;

if( !pc )
goto EXIT;

if( !dbus_pending_call_set_notify(pc, xconnman_get_properties_cb, 0, 0) )
goto EXIT;

Expand Down Expand Up @@ -938,6 +944,9 @@ static gboolean xconnman_check_service(void)
if( !dbus_connection_send_with_reply(connman_bus, req, &pc, -1) )
goto EXIT;

if( !pc )
goto EXIT;

if( !dbus_pending_call_set_notify(pc, xconnman_check_service_cb, 0, 0) )
goto EXIT;

Expand Down

0 comments on commit fd90f36

Please sign in to comment.