GNOME Bugzilla – Bug 585089
Criticals when dropping the last tab from one window into another.
Last modified: 2010-03-04 14:50:02 UTC
When I drag the final tab from one window into another, Empathy criticals: ** (empathy:1693): DEBUG: chat_window_update_chat_tab: Updating chat tab, name=Dafydd Harries, account=jabber0, subject=(null), remote_contact=0x16006b0 (empathy:1693): GLib-GObject-WARNING **: invalid unclassed pointer in cast to `GtkImage' Gtk-CRITICAL **: gtk_image_set_from_icon_name: assertion `GTK_IS_IMAGE (image)' failed aborting...
+ Trace 215906
It seems this was introduced when I added the right-click menus to the tabs. I took a look to figure out what was going wrong, but couldn't figure it out. Empathy's tab drag-and-drop code isn't obviously right, but it's not obviously wrong either. :)
I can confirm bad behavior of the tab drag & drop functionality of Empathy 2.28. To reproduce the crash: - Open 2 chatwindows - Drag one into the other /var/messages: Nov 14 13:42:38 ruben-laptop kernel: [19750.191893] empathy[2098]: segfault at 1d ip 06299f69 sp bfecac70 error 4 in libgtk-x11-2.0.so.0.1800.3[603f000+3b8000]
*** Bug 588799 has been marked as a duplicate of this bug. ***
I looked into this and it appears to be that the data "chat-window-menu-image" is pointing to is freed when moving the tab. I *think* it's happening when the old GtkNotebook is destroyed. It unparents the children of the menu widget which in turn unrefs them.
Nice catch! I added some ref in this branch but that doesn 't seem enough to fix the crash: http://git.collabora.co.uk/?p=user/cassidy/empathy;a=shortlog;h=refs/heads/dnd-crash-585089 Now we got this error: Gtk-CRITICAL **: gtk_selection_data_set: assertion `length <= 0' failed aborting... Program received signal SIGABRT, Aborted. 0x00007fffeec834b5 in *__GI_raise (sig=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 64 ../nptl/sysdeps/unix/sysv/linux/raise.c: Aucun fichier ou dossier de ce type. in ../nptl/sysdeps/unix/sysv/linux/raise.c (gdb) bt
+ Trace 219716
*** Bug 605015 has been marked as a duplicate of this bug. ***
I ran into that too after adding a hack for the first issue. My understanding is the assertion happens when gtk_notebook_drag_drop_get (a handler for GtkWidget's drag_data_get) calls gtk_selection_data_set with NULL data for the third parameter (&priv->detached_tab->child is NULL). This then causes the assertion in gtk_selection_data_set. If I remember correctly, the order was empathy-chat-window.c's chat_window_drag_data_received was called and resolved, then something triggers gtk_notebook_drag_drop_get to be called at least two more times. The first works fine, but the second throws this assertion. I did try commenting out that section of code, and it didn't seem to affect anything though. So I'm not really sure what the root cause of it is.
I investigated this further and found that the reason for the assertion is because gtk_drag_dest_set in empathy-chat-window.c is called with GTK_DEST_DEFAULT_ALL. GtkNotebook internally calls it 0. GTK_DEST_DEFAULT_ALL specifically includes GTK_DEST_DEFAULT_DROP, which automatically handles when a drop occurs. The problem is that GtkNotebook's drop handler is also called. That's why drag-data-get is signaled twice (both handlers signal it). By the time the second handler is called, it's already been handled by the first handler and the tab has been moved. The notebook has no tabs left, passes NULL into gtk_selection_data_set, and the assertion is tripped. Unfortunately, just removing the GTK_DEST_DEFAULT_DROP flag breaks dragging contacts and files onto the window. I believe it's because, without that flag, the drag-drop signal isn't handled for them.
*** Bug 605519 has been marked as a duplicate of this bug. ***
*** Bug 606566 has been marked as a duplicate of this bug. ***
Guillaume: (In reply to comment #5) > Nice catch! I added some ref in this branch but that doesn 't seem enough to > fix the crash: > http://git.collabora.co.uk/?p=user/cassidy/empathy;a=shortlog;h=refs/heads/dnd-crash-585089 > I came up with something similar when I reported this, although it likely leaks the reference: http://bugzilla-attachments.gnome.org/attachment.cgi?id=151127 Anyway, that fixed the crash for me and started printing the length warning, both solutions should be equivalent so I don't see why you still get the crash after ref'ing the widgets.
This is too affect to Empathy Version 2.29.4
Mike: if you're ok with my patch maybe we could already commit it?
Looks good to me. Quite an elegant solution :)
P.S. It does still get an assertion though per my last long post? It's not a crash, so I imagine that's not a blocker for getting this fix out. Should that be opened in another bug?
I merged my patch but let's keep this bug open as there is obviously something wrong because of the assertion. commit 183fa2e8a94d94a7098120fc43cde9ad83869de6 Author: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> Date: Mon Dec 21 11:20:02 2009 +0000 chat_window_create_label: ref the widgets stored as data so we are sure they stay alive when doing DnD
The real issue is that we're interfering with how GtkNotebook does drag and drop, fixed in: http://git.collabora.co.uk/?p=user/sjoerd/empathy.git;a=shortlog;h=refs/heads/drag-n-drop
Looks good. Please merge.
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.
*** Bug 606567 has been marked as a duplicate of this bug. ***
I just had a crash. empathy did not crash it just got hidden and then again accessed it from messaging menu. my every account was still connected I am using 2.29.90.1
The last issue is actually a GTK+ bug that has not been fixed yet: bug #609929