[gnome-control-center/benzea/fix-kbd-crash: 3/3] power: Handle cancelled kbd brightness proxy creation



commit 1926706499e4b49adb415e5b3062b616e20e7fb3
Author: Benjamin Berg <bberg redhat com>
Date:   Mon Sep 24 10:55:35 2018 +0200

    power: Handle cancelled kbd brightness proxy creation
    
    The code must not access the passed panel if the operation to create the
    keyboard proxy has been cancelled. This fixes a possible crash when
    switching away from the power panel.

 panels/power/cc-power-panel.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/panels/power/cc-power-panel.c b/panels/power/cc-power-panel.c
index 16dd63c9b..0020e40cf 100644
--- a/panels/power/cc-power-panel.c
+++ b/panels/power/cc-power-panel.c
@@ -1116,7 +1116,7 @@ on_kbd_property_change (GDBusProxy *proxy,
 static void
 got_kbd_proxy_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
 {
-  CcPowerPanel *self = CC_POWER_PANEL (user_data);
+  CcPowerPanel *self;
   g_autoptr(GError) error = NULL;
   GDBusProxy *kbd_proxy;
 
@@ -1128,6 +1128,7 @@ got_kbd_proxy_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
       return;
     }
 
+  self = CC_POWER_PANEL (user_data);
   self->kbd_proxy = kbd_proxy;
 
   /* we want to change the bar if the user presses brightness buttons */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]