Bug 557315 – stale clipboard target cache

2008-10-25  Matthias Clasen  <mclasen@redhat.com>

        Bug 557315 – stale clipboard target cache

        * gtk/gtkclipboard.c (gtk_clipboard_set_contents): Remove cached
        targets. Pointed out by Evan Stade


svn path=/trunk/; revision=21713
This commit is contained in:
Matthias Clasen 2008-10-25 23:12:03 +00:00 committed by Matthias Clasen
parent c29237900c
commit 2db879fe87
2 changed files with 17 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2008-10-25 Matthias Clasen <mclasen@redhat.com>
Bug 557315 stale clipboard target cache
* gtk/gtkclipboard.c (gtk_clipboard_set_contents): Remove cached
targets. Pointed out by Evan Stade
2008-10-24 Tristan Van Berkom <tvb@gnome.org> 2008-10-24 Tristan Van Berkom <tvb@gnome.org>
* gtk/gtkwidget.c: Added a note about GtkWidget:has-tooltip in * gtk/gtkwidget.c: Added a note about GtkWidget:has-tooltip in

View File

@ -236,6 +236,7 @@ gtk_clipboard_finalize (GObject *object)
g_signal_handler_disconnect (clipboard_widget, clipboard->notify_signal_id); g_signal_handler_disconnect (clipboard_widget, clipboard->notify_signal_id);
g_free (clipboard->storable_targets); g_free (clipboard->storable_targets);
g_free (clipboard->cached_targets);
G_OBJECT_CLASS (gtk_clipboard_parent_class)->finalize (object); G_OBJECT_CLASS (gtk_clipboard_parent_class)->finalize (object);
} }
@ -514,6 +515,13 @@ gtk_clipboard_set_contents (GtkClipboard *clipboard,
{ {
clipboard->have_selection = TRUE; clipboard->have_selection = TRUE;
if (clipboard->n_cached_targets != -1)
{
g_free (clipboard->cached_targets);
clipboard->cached_targets = NULL;
clipboard->n_cached_targets = -1;
}
if (!(clipboard->have_owner && have_owner) || if (!(clipboard->have_owner && have_owner) ||
clipboard->user_data != user_data) clipboard->user_data != user_data)
{ {
@ -1840,8 +1848,9 @@ gtk_clipboard_owner_change (GtkClipboard *clipboard,
{ {
if (clipboard->n_cached_targets != -1) if (clipboard->n_cached_targets != -1)
{ {
clipboard->n_cached_targets = -1;
g_free (clipboard->cached_targets); g_free (clipboard->cached_targets);
clipboard->cached_targets = NULL;
clipboard->n_cached_targets = -1;
} }
} }