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



commit e037fdf1a00f59e30411e35d356d77307ae7e2cd
Author: Benjamin Berg <bberg redhat com>
Date:   Mon Sep 24 08:55:35 2018 +0000

    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.
    
    
    (cherry picked from commit 75556d7c5af3cdff5e527409cce05e9903181fe7)

 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 2c13b7d31..b4c96e1dd 100644
--- a/panels/power/cc-power-panel.c
+++ b/panels/power/cc-power-panel.c
@@ -1107,7 +1107,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;
 
@@ -1119,6 +1119,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]