selection: no critical when the callback of a retrieval destroys its widget, as the clipboard does with the widgets of requests that run at the same time
This commit is contained in:
parent
bc6cc6a5d3
commit
4f99a52c7e
1 changed files with 9 additions and 1 deletions
|
|
@ -2721,6 +2721,7 @@ gboolean
|
|||
_gtk_selection_notify (GtkWidget *widget,
|
||||
GdkEventSelection *event)
|
||||
{
|
||||
GdkWindow *window;
|
||||
GList *tmp_list;
|
||||
GtkRetrievalInfo *info = NULL;
|
||||
guchar *buffer = NULL;
|
||||
|
|
@ -2745,6 +2746,8 @@ _gtk_selection_notify (GtkWidget *widget,
|
|||
if (!tmp_list) /* no retrieval in progress */
|
||||
return FALSE;
|
||||
|
||||
window = g_object_ref (widget->window);
|
||||
|
||||
if (event->property != GDK_NONE)
|
||||
length = gdk_selection_property_get (widget->window, &buffer,
|
||||
&type, &format);
|
||||
|
|
@ -2758,6 +2761,7 @@ _gtk_selection_notify (GtkWidget *widget,
|
|||
/* structure will be freed in timeout */
|
||||
gtk_selection_retrieval_report (info,
|
||||
GDK_NONE, 0, NULL, -1, event->time);
|
||||
g_object_unref (window);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -2786,7 +2790,11 @@ _gtk_selection_notify (GtkWidget *widget,
|
|||
buffer, length, event->time);
|
||||
}
|
||||
|
||||
gdk_property_delete (widget->window, event->property);
|
||||
/* the window held, as the callback may have destroyed the widget (the
|
||||
* clipboard does so with the widgets of requests that ran at the same
|
||||
* time as another) */
|
||||
gdk_property_delete (window, event->property);
|
||||
g_object_unref (window);
|
||||
|
||||
g_free (buffer);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue