[gnome-control-center/benzea/fix-brightness-scale-crash] power: Fix crash when power proxy becomes ready after finalize




commit 58c4a39af1568f3a46bb43fa730f6640fd7664d5
Author: Benjamin Berg <bberg redhat com>
Date:   Tue Feb 16 15:42:27 2021 +0100

    power: Fix crash when power proxy becomes ready after finalize
    
    While the code was using the pattern to cancel the operation, it was
    still resolving the user_data pointer even in the case the operation has
    been cancelled.
    
    Fix this by simply moving the initialization.
    
    Fixes: #1260

 panels/power/cc-brightness-scale.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
---
diff --git a/panels/power/cc-brightness-scale.c b/panels/power/cc-brightness-scale.c
index 517177771..2df1ab5ed 100644
--- a/panels/power/cc-brightness-scale.c
+++ b/panels/power/cc-brightness-scale.c
@@ -136,8 +136,6 @@ got_proxy_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
   CcBrightnessScale *self;
   GDBusProxy *proxy;
 
-  self = CC_BRIGHTNESS_SCALE (user_data);
-
   proxy = cc_object_storage_create_dbus_proxy_finish (res, &error);
   if (proxy == NULL)
     {
@@ -146,6 +144,7 @@ got_proxy_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
       return;
     }
 
+  self = CC_BRIGHTNESS_SCALE (user_data);
   self->proxy = proxy;
 
   g_signal_connect_object (proxy, "g-properties-changed",


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