[evolution] Fix cairo_surface_t memory leaks after drag begin



commit 8137ff2e1453c942cabe34702fa227f988a2dd4f
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jun 9 13:00:58 2022 +0200

    Fix cairo_surface_t memory leaks after drag begin
    
    The gtk_drag_set_icon_surface() references the surface on its own.

 src/e-util/e-filter-rule.c                 | 1 +
 src/e-util/e-rule-editor.c                 | 1 +
 src/mail/e-mail-folder-sort-order-dialog.c | 1 +
 src/mail/em-filter-rule.c                  | 1 +
 src/mail/em-folder-tree.c                  | 1 +
 5 files changed, 5 insertions(+)
---
diff --git a/src/e-util/e-filter-rule.c b/src/e-util/e-filter-rule.c
index 29c00f06f1..2fbce0beed 100644
--- a/src/e-util/e-filter-rule.c
+++ b/src/e-util/e-filter-rule.c
@@ -218,6 +218,7 @@ event_box_drag_begin (GtkWidget *widget,
        cairo_surface_set_device_offset (surface, 0, 0);
 
        gtk_drag_set_icon_surface (context, surface);
+       cairo_surface_destroy (surface);
 }
 
 static gboolean
diff --git a/src/e-util/e-rule-editor.c b/src/e-util/e-rule-editor.c
index 83a46c02a0..728fa24d90 100644
--- a/src/e-util/e-rule-editor.c
+++ b/src/e-util/e-rule-editor.c
@@ -759,6 +759,7 @@ editor_tree_drag_begin_cb (GtkWidget *widget,
 
        surface = gtk_tree_view_create_row_drag_icon (editor->list, path);
        gtk_drag_set_icon_surface (context, surface);
+       cairo_surface_destroy (surface);
 
        gtk_tree_path_free (path);
 }
diff --git a/src/mail/e-mail-folder-sort-order-dialog.c b/src/mail/e-mail-folder-sort-order-dialog.c
index b361e27c54..e32986da9c 100644
--- a/src/mail/e-mail-folder-sort-order-dialog.c
+++ b/src/mail/e-mail-folder-sort-order-dialog.c
@@ -324,6 +324,7 @@ sort_order_tree_drag_begin_cb (GtkWidget *widget,
 
        surface = gtk_tree_view_create_row_drag_icon (tree_view, path);
        gtk_drag_set_icon_surface (context, surface);
+       cairo_surface_destroy (surface);
 
        gtk_tree_path_free (path);
 
diff --git a/src/mail/em-filter-rule.c b/src/mail/em-filter-rule.c
index 631be165e8..e3e7ad920e 100644
--- a/src/mail/em-filter-rule.c
+++ b/src/mail/em-filter-rule.c
@@ -486,6 +486,7 @@ event_box_drag_begin (GtkWidget *widget,
        cairo_surface_set_device_offset (surface, 0, 0);
 
        gtk_drag_set_icon_surface (context, surface);
+       cairo_surface_destroy (surface);
 }
 
 static gboolean
diff --git a/src/mail/em-folder-tree.c b/src/mail/em-folder-tree.c
index 8fc3fa8437..3fd26219ef 100644
--- a/src/mail/em-folder-tree.c
+++ b/src/mail/em-folder-tree.c
@@ -2093,6 +2093,7 @@ tree_drag_begin (GtkWidget *widget,
 
        s = gtk_tree_view_create_row_drag_icon (tree_view, path);
        gtk_drag_set_icon_surface (context, s);
+       cairo_surface_destroy (s);
 
        gtk_tree_path_free (path);
 }


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