[Xfce4-commits] [apps/xfce4-notifyd] 23/29: Initialize the data required for workarea, notification lists, etc... only once. The first time a notification is created the counter last_notification_id is always 2. This counter is used inside the size allocate handler, it is checked, if it is 2, the data are created. The problem is that gtk sends us two or three size_allocates, leading the recreating of the above mentioned data and eventually to a memory leak.

noreply at xfce.org noreply at xfce.org
Wed Jun 29 23:20:13 CEST 2016


This is an automated email from the git hooks/post-receive script.

ochosi pushed a commit to branch master
in repository apps/xfce4-notifyd.

commit 681c9a78c333f48f307e732ee69b3fe448ad3bbb
Author: Ali Abdallah <aliovx at gmail.com>
Date:   Sun Nov 1 19:47:16 2015 +0100

    Initialize the data required for workarea, notification lists, etc... only once.
    The first time a notification is created the counter last_notification_id
    is always 2. This counter is used inside the size allocate handler, it is
    checked, if it is 2, the data are created. The problem is that
    gtk sends us two or three size_allocates, leading the
    recreating of the above mentioned data and eventually to a memory leak.
---
 xfce4-notifyd/xfce-notify-daemon.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/xfce4-notifyd/xfce-notify-daemon.c b/xfce4-notifyd/xfce-notify-daemon.c
index 07d0998..07b4de6 100644
--- a/xfce4-notifyd/xfce-notify-daemon.c
+++ b/xfce4-notifyd/xfce-notify-daemon.c
@@ -667,17 +667,19 @@ xfce_notify_daemon_window_size_allocate(GtkWidget *widget,
     GdkDevice *pointer;
     gint x, y, monitor, screen_n, max_width;
     GdkRectangle *geom_tmp, geom, initial, widget_geom;
-    
     GList *list;
     gboolean found = FALSE;
+    static gboolean placement_data_initialized = FALSE;
 
     DBG("Size allocate called for %d", xndaemon->last_notification_id);
 
-    if(xndaemon->last_notification_id == 2)
+    if (placement_data_initialized == FALSE) {
         /* First time we place a notification, initialize the arrays needed for
          * that (workarea, notification lists...). */
         xfce_notify_daemon_init_placement_data(xndaemon);
-
+        placement_data_initialized = TRUE;
+    }
+    
     geom_tmp = xfce_notify_window_get_geometry(window);
     if(geom_tmp->width != 0 && geom_tmp->height != 0) {
         /* Notification has already been placed previously. Not sure if that

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list