mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 02:40:11 +00:00
mir: Fix potential use of NULL GDBusConnection
If we fail to connect to the session bus, it would be a bit silly to immediately try and use that NULL connection. Signed-off-by: Philip Withnall <withnall@endlessm.com> https://bugzilla.gnome.org/show_bug.cgi?id=668590
This commit is contained in:
parent
fec0dc2b13
commit
276c462553
@ -176,6 +176,7 @@ _gdk_mir_display_open (const gchar *display_name)
|
||||
MirPixelFormat sw_pixel_format, hw_pixel_format;
|
||||
GdkMirDisplay *display;
|
||||
GDBusConnection *session;
|
||||
GError *error = NULL;
|
||||
|
||||
connection = mir_connect_sync (NULL, g_get_prgname ());
|
||||
if (!connection)
|
||||
@ -208,7 +209,15 @@ _gdk_mir_display_open (const gchar *display_name)
|
||||
display->sw_pixel_format = sw_pixel_format;
|
||||
display->hw_pixel_format = hw_pixel_format;
|
||||
|
||||
session = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
|
||||
session = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
|
||||
|
||||
if (session == NULL)
|
||||
{
|
||||
g_error ("Error connecting to D-Bus session bus: %s", error->message);
|
||||
g_clear_error (&error);
|
||||
mir_connection_release (connection);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
display->content_service = content_hub_service_proxy_new_sync (
|
||||
session,
|
||||
|
Loading…
Reference in New Issue
Block a user