[gimp] app: clear the clipboard after storing its contents, upon quitting.



commit fca6371e29162d33d8e59a9e28fe698ff6157198
Author: Jehan <jehan girinstud io>
Date:   Wed May 6 15:41:19 2020 +0200

    app: clear the clipboard after storing its contents, upon quitting.
    
    If we don't do this, the clipboard owner doesn't get unreffed (also the
    GtkClipboardClearFunc is not called either, but we don't set any so this
    was not a big problem).
    
    The main consequence was that copying was setting the Gimp object as an
    owner, which kept a reference and prevent its finalize() method to run,
    hence was leaking data (and in particular some GEGL buffers for
    clipboard operations, which was how the issue became more visible upon
    exit).

 app/widgets/gimpclipboard.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/app/widgets/gimpclipboard.c b/app/widgets/gimpclipboard.c
index 44ceac7e2f..7dc7e2c5f9 100644
--- a/app/widgets/gimpclipboard.c
+++ b/app/widgets/gimpclipboard.c
@@ -134,6 +134,12 @@ gimp_clipboard_exit (Gimp *gimp)
       gtk_clipboard_store (clipboard);
     }
 
+  if (clipboard)
+    /* If we don't clear the clipboard, it keeps a reference on the object
+     * owner (i.e. Gimp object probably) which fails to finalize.
+     */
+    gtk_clipboard_clear (clipboard);
+
   g_object_set_data (G_OBJECT (gimp), GIMP_CLIPBOARD_KEY, NULL);
 }
 


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