power: Fix crash when panel is closed quickly
Fix a use-after-free while creating the dbus proxy for org.gnome.SettingsDaemon.Power.Keyboard. This fix is identical to the previous fix for the screen proxy. https://bugzilla.gnome.org/show_bug.cgi?id=794089
This commit is contained in:
parent
9066ce5525
commit
1d72a0b350
1 changed files with 8 additions and 5 deletions
|
@ -1117,11 +1117,11 @@ static void
|
||||||
got_kbd_proxy_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
|
got_kbd_proxy_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
CcPowerPanel *self = CC_POWER_PANEL (user_data);
|
CcPowerPanel *self;
|
||||||
CcPowerPanelPrivate *priv = self->priv;
|
GDBusProxy *kbd_proxy;
|
||||||
|
|
||||||
priv->kbd_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
|
kbd_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
|
||||||
if (priv->kbd_proxy == NULL)
|
if (kbd_proxy == NULL)
|
||||||
{
|
{
|
||||||
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|
||||||
g_printerr ("Error creating keyboard proxy: %s\n", error->message);
|
g_printerr ("Error creating keyboard proxy: %s\n", error->message);
|
||||||
|
@ -1129,8 +1129,11 @@ got_kbd_proxy_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self = CC_POWER_PANEL (user_data);
|
||||||
|
self->priv->kbd_proxy = kbd_proxy;
|
||||||
|
|
||||||
/* we want to change the bar if the user presses brightness buttons */
|
/* we want to change the bar if the user presses brightness buttons */
|
||||||
g_signal_connect (priv->kbd_proxy, "g-properties-changed",
|
g_signal_connect (kbd_proxy, "g-properties-changed",
|
||||||
G_CALLBACK (on_kbd_property_change), self);
|
G_CALLBACK (on_kbd_property_change), self);
|
||||||
|
|
||||||
sync_kbd_brightness (self);
|
sync_kbd_brightness (self);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue