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).

(cherry picked from commit fca6371e29)
This commit is contained in:
Jehan
2020-05-06 15:41:19 +02:00
parent 694ce3fd54
commit ef217108a6

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