summaryrefslogtreecommitdiff
path: root/gtk/gtktextbuffer.c
diff options
context:
space:
mode:
authorMichael Natterer <mitch@imendio.com>2006-04-28 12:13:04 +0000
committerMichael Natterer <mitch@src.gnome.org>2006-04-28 12:13:04 +0000
commit7e15674cd9909e1b3e73e0c53f9978e5eaaef0ca (patch)
treef33fd8da7b67b58d5e5cc6cb3b1ce580ba28611c /gtk/gtktextbuffer.c
parent543f6cbbe6b5b33affe65f4939811e74f150bb0c (diff)
downloadgtk+-7e15674cd9909e1b3e73e0c53f9978e5eaaef0ca.tar.gz
keep a reference to the source buffer while the clipboard contents buffer
2006-04-28 Michael Natterer <mitch@imendio.com> * gtk/gtktextbuffer.c (create_clipboard_contents_buffer): keep a reference to the source buffer while the clipboard contents buffer exists, because it is needed for serializing the contents buffer. Makes copying from the contents buffer possible even after the resp. text view is destroyed (for example when there is a clipboard manager running on app exit) (bug #339195).
Diffstat (limited to 'gtk/gtktextbuffer.c')
-rw-r--r--gtk/gtktextbuffer.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gtk/gtktextbuffer.c b/gtk/gtktextbuffer.c
index ea04b885b0..628686c8b5 100644
--- a/gtk/gtktextbuffer.c
+++ b/gtk/gtktextbuffer.c
@@ -2967,6 +2967,13 @@ create_clipboard_contents_buffer (GtkTextBuffer *buffer)
g_object_set_data (G_OBJECT (contents), I_("gtk-text-buffer-clipboard"),
GINT_TO_POINTER (1));
+ /* Ref the source buffer as long as the clipboard contents buffer
+ * exists, because it's needed for serializing the contents buffer.
+ * See http://bugzilla.gnome.org/show_bug.cgi?id=339195
+ */
+ g_object_ref (buffer);
+ g_object_weak_ref (G_OBJECT (contents), (GWeakNotify) g_object_unref, buffer);
+
return contents;
}