mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-09 14:40:54 +00:00
libsysprof: handle bus/proxy failure gracefully
This commit is contained in:
@ -61,15 +61,12 @@ sysprof_helpers_init (SysprofHelpers *self)
|
|||||||
{
|
{
|
||||||
g_autoptr(GDBusConnection) bus = NULL;
|
g_autoptr(GDBusConnection) bus = NULL;
|
||||||
|
|
||||||
bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL);
|
if ((bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL)))
|
||||||
g_return_if_fail (bus != NULL);
|
self->proxy = ipc_service_proxy_new_sync (bus,
|
||||||
|
G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START_AT_CONSTRUCTION,
|
||||||
self->proxy = ipc_service_proxy_new_sync (bus,
|
"org.gnome.Sysprof3",
|
||||||
G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START_AT_CONSTRUCTION,
|
"/org/gnome/Sysprof3",
|
||||||
"org.gnome.Sysprof3",
|
NULL, NULL);
|
||||||
"/org/gnome/Sysprof3",
|
|
||||||
NULL, NULL);
|
|
||||||
g_return_if_fail (self->proxy != NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SysprofHelpers *
|
SysprofHelpers *
|
||||||
@ -178,7 +175,7 @@ sysprof_helpers_list_processes (SysprofHelpers *self,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ipc_service_call_list_processes_sync (self->proxy, &fixed_ar, cancellable, NULL))
|
if (self->proxy && ipc_service_call_list_processes_sync (self->proxy, &fixed_ar, cancellable, NULL))
|
||||||
{
|
{
|
||||||
const gint32 *data;
|
const gint32 *data;
|
||||||
gsize len;
|
gsize len;
|
||||||
@ -191,6 +188,7 @@ sysprof_helpers_list_processes (SysprofHelpers *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
helpers_list_processes (processes, n_processes);
|
helpers_list_processes (processes, n_processes);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user