[gnome-control-center] power: Fix crash when panel is closed quickly
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] power: Fix crash when panel is closed quickly
- Date: Mon, 5 Mar 2018 15:48:49 +0000 (UTC)
commit 1d72a0b3507d425011a4d280ebbe53f3463d3ed9
Author: Benjamin Berg <bberg redhat com>
Date: Mon Mar 5 16:12:48 2018 +0100
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
panels/power/cc-power-panel.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/panels/power/cc-power-panel.c b/panels/power/cc-power-panel.c
index aff0ae8e6..f9b67a458 100644
--- a/panels/power/cc-power-panel.c
+++ b/panels/power/cc-power-panel.c
@@ -1117,11 +1117,11 @@ static void
got_kbd_proxy_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
{
GError *error = NULL;
- CcPowerPanel *self = CC_POWER_PANEL (user_data);
- CcPowerPanelPrivate *priv = self->priv;
+ CcPowerPanel *self;
+ GDBusProxy *kbd_proxy;
- priv->kbd_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
- if (priv->kbd_proxy == NULL)
+ kbd_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
+ if (kbd_proxy == NULL)
{
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
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;
}
+ self = CC_POWER_PANEL (user_data);
+ self->priv->kbd_proxy = kbd_proxy;
+
/* 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);
sync_kbd_brightness (self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]