forked from AuroraMiddleware/gtk
DND: Clean up weak pointers when they are no longer needed
Failure to do so leads to memory corruption down the road.
This was introduced in commit 650c25e06c
.
https://bugzilla.gnome.org/show_bug.cgi?id=746602
This commit is contained in:
parent
ec32d8dade
commit
e7eaca9534
13
gtk/gtkdnd.c
13
gtk/gtkdnd.c
@ -1637,6 +1637,7 @@ _gtk_drag_dest_handle_event (GtkWidget *toplevel,
|
|||||||
case GDK_DRAG_LEAVE:
|
case GDK_DRAG_LEAVE:
|
||||||
if (info->widget)
|
if (info->widget)
|
||||||
{
|
{
|
||||||
|
g_object_remove_weak_pointer (G_OBJECT (info->widget), (gpointer *) &info->widget);
|
||||||
gtk_drag_dest_leave (info->widget, context, event->dnd.time);
|
gtk_drag_dest_leave (info->widget, context, event->dnd.time);
|
||||||
info->widget = NULL;
|
info->widget = NULL;
|
||||||
}
|
}
|
||||||
@ -1657,6 +1658,7 @@ _gtk_drag_dest_handle_event (GtkWidget *toplevel,
|
|||||||
*/
|
*/
|
||||||
if (info->widget)
|
if (info->widget)
|
||||||
{
|
{
|
||||||
|
g_object_remove_weak_pointer (G_OBJECT (info->widget), (gpointer *) &info->widget);
|
||||||
gtk_drag_dest_leave (info->widget, context, event->dnd.time);
|
gtk_drag_dest_leave (info->widget, context, event->dnd.time);
|
||||||
info->widget = NULL;
|
info->widget = NULL;
|
||||||
}
|
}
|
||||||
@ -1689,6 +1691,7 @@ _gtk_drag_dest_handle_event (GtkWidget *toplevel,
|
|||||||
|
|
||||||
if (info->widget && !found)
|
if (info->widget && !found)
|
||||||
{
|
{
|
||||||
|
g_object_remove_weak_pointer (G_OBJECT (info->widget), (gpointer *) &info->widget);
|
||||||
gtk_drag_dest_leave (info->widget, context, event->dnd.time);
|
gtk_drag_dest_leave (info->widget, context, event->dnd.time);
|
||||||
info->widget = NULL;
|
info->widget = NULL;
|
||||||
}
|
}
|
||||||
@ -1918,10 +1921,11 @@ gtk_drag_find_widget (GtkWidget *widget,
|
|||||||
found = callback (widget, context, x, y, time);
|
found = callback (widget, context, x, y, time);
|
||||||
|
|
||||||
/* If so, send a "drag-leave" to the last widget */
|
/* If so, send a "drag-leave" to the last widget */
|
||||||
if (found)
|
if (found && info->widget != widget)
|
||||||
{
|
{
|
||||||
if (info->widget && info->widget != widget)
|
if (info->widget)
|
||||||
{
|
{
|
||||||
|
g_object_remove_weak_pointer (G_OBJECT (info->widget), (gpointer *) &info->widget);
|
||||||
gtk_drag_dest_leave (info->widget, context, time);
|
gtk_drag_dest_leave (info->widget, context, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2011,6 +2015,11 @@ gtk_drag_proxy_begin (GtkWidget *widget,
|
|||||||
static void
|
static void
|
||||||
gtk_drag_dest_info_destroy (gpointer data)
|
gtk_drag_dest_info_destroy (gpointer data)
|
||||||
{
|
{
|
||||||
|
GtkDragDestInfo *info = (GtkDragDestInfo *)data;
|
||||||
|
if (info->widget)
|
||||||
|
{
|
||||||
|
g_object_remove_weak_pointer (G_OBJECT (info->widget), (gpointer *) &info->widget);
|
||||||
|
}
|
||||||
g_slice_free (GtkDragDestInfo, data);
|
g_slice_free (GtkDragDestInfo, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user