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).
This commit is contained in:
Jehan 2020-05-06 15:41:19 +02:00
parent b680945752
commit fca6371e29
1 changed files with 6 additions and 0 deletions

View File

@ -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);
}