gtkdnd: Account for setting a same icon helper
authorCarlos Garnacho <carlosg@gnome.org>
Mon, 6 Jul 2015 17:33:49 +0000 (19:33 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Tue, 7 Jul 2015 09:24:37 +0000 (11:24 +0200)
g_set_object() will take care of ref'ing before destroying the previous
instance, which might actually be the same pointer.

https://bugzilla.gnome.org/show_bug.cgi?id=751401

gtk/gtkdnd.c

index 732d237231f588aa42c75f763550f09212c7b111..399e319e5816a0b2dda123c90c35bddea7b5c684 100644 (file)
@@ -3141,10 +3141,7 @@ set_icon_helper (GdkDragContext *context,
 
       info = gtk_drag_get_source_info (context, FALSE);
 
-      if (info->icon_helper)
-        g_object_unref (info->icon_helper);
-      info->icon_helper = g_object_ref (helper);
-
+      g_set_object (&info->icon_helper, helper);
       gtk_drag_set_icon_window (context, NULL, hot_x, hot_y, TRUE);
     }
   else