[gnome-control-center] printers: Do not crash due to wrong argument



commit cdb4727690525c736096625683fdff8b951f0127
Author: Marek Kasik <mkasik redhat com>
Date:   Wed Jun 3 17:59:01 2020 +0200

    printers: Do not crash due to wrong argument
    
    Callback for handling of "notification-dismiss-button" got its
    parameters swapped. This resulted in crash when user closed
    notification about deleted printer.
    This commit converts the on_notification_dismissed() function
    to accept swapped arguments as was probably intended.

 panels/printers/cc-printers-panel.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/panels/printers/cc-printers-panel.c b/panels/printers/cc-printers-panel.c
index db5bc9bc8..68c5b194d 100644
--- a/panels/printers/cc-printers-panel.c
+++ b/panels/printers/cc-printers-panel.c
@@ -636,11 +636,8 @@ on_printer_deletion_undone (CcPrintersPanel *self)
 }
 
 static void
-on_notification_dismissed (GtkButton *button,
-                           gpointer   user_data)
+on_notification_dismissed (CcPrintersPanel *self)
 {
-  CcPrintersPanel        *self = (CcPrintersPanel*) user_data;
-
   if (self->deleted_printer_name != NULL)
     {
       PpPrinter *printer;
@@ -660,7 +657,7 @@ on_notification_dismissed (GtkButton *button,
 static gboolean
 on_remove_printer_timeout (gpointer user_data)
 {
-  on_notification_dismissed (NULL, user_data);
+  on_notification_dismissed (user_data);
 
   return G_SOURCE_REMOVE;
 }
@@ -675,7 +672,7 @@ on_printer_deleted (CcPrintersPanel *self,
 
   gtk_widget_hide (GTK_WIDGET (printer_entry));
 
-  on_notification_dismissed (NULL, self);
+  on_notification_dismissed (self);
 
   g_object_get (printer_entry,
                 "printer-name", &printer_name,


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