GNOME Bugzilla – Bug 639875
crashes when unparenting a tab from a window (drag-n-drop it outside of it)
Last modified: 2015-01-31 05:10:32 UTC
When draggin a tab out of a window to get a new window with the dragged tab, this crash pops: (epiphany:26744): Gtk-CRITICAL **: gtk_widget_unmap: assertion `GTK_IS_WIDGET (widget)' failed Program received signal SIGSEGV, Segmentation fault. gtk_widget_verify_invariants (widget=0x88c0d80) at gtkwidget.c:8778 8778 if (widget->priv->verifying_invariants_count > 0) (gdb) bt
+ Trace 225576
Yes I can confirm this.
Seems fixed, cant reproduce. Close ?
I can reproduce with GTK+/WebKitGTK+/Epiphany master (but can't with Debian's 3.0 stack!)
+ Trace 227949
Thread 1 (Thread 0xb4533880 (LWP 27723))
It seems the issue is that the child of the DnD window is the tab label, which is destroyed at some point during the process. If I add an extra ref in EphyNotebook::insert-page (basically, leave the ref_sink and comment the unref) then everything works. Not sure who should be keeping the ref here though, the code in GTK+ seems OK to me.
*** Bug 664488 has been marked as a duplicate of this bug. ***
So, I believe this was a GTK+ bug in the end. Patch coming.
Created attachment 204360 [details] [review] Fix DnD crash.
Review of attachment 204360 [details] [review]: Makes sense, thanks.
Comment on attachment 204360 [details] [review] Fix DnD crash. Pushed as eeb9de80e17d1915d877c98eabd9a9a1f4423e9c
Closing.
The change in eeb9de80e17d1915d877c98eabd9a9a1f4423e9c causes gedit 3.3.x to crash while drag'n'drop a notebook tab of it. Revering it make it behave normal again.
(In reply to comment #11) > The change in eeb9de80e17d1915d877c98eabd9a9a1f4423e9c causes gedit 3.3.x to > crash while drag'n'drop a notebook tab of it. Revering it make it behave normal > again. Could you attach a trace for completeness? About the issue itself, the patch still seems logically correct to me. If the Notebook does not own the tab label anymore it probably should not go around unparenting it. I can only reproduce this in gedit, so perhaps they were applying some workaround for the previous bug that is now incorrect?
Program received signal SIGSEGV, Segmentation fault. 0x00007ffff6f566a6 in gtk_widget_verify_invariants (widget=0xe9e900) at /build/buildd/gtk+3.0-3.3.7+git20120108.69a52957/./gtk/gtkwidget.c:8373 8373 /build/buildd/gtk+3.0-3.3.7+git20120108.69a52957/./gtk/gtkwidget.c: Datei oder Verzeichnis nicht gefunden. in /build/buildd/gtk+3.0-3.3.7+git20120108.69a52957/./gtk/gtkwidget.c (gdb) bt
+ Trace 229427
Program received signal SIGSEGV, Segmentation fault. 0x00007ffff6f5ad17 in gtk_widget_get_toplevel (widget=0xcdeaf0) at /build/buildd/gtk+3.0-3.3.7+git20120108.69a52957/./gtk/gtkwidget.c:9602 9602 /build/buildd/gtk+3.0-3.3.7+git20120108.69a52957/./gtk/gtkwidget.c: Datei oder Verzeichnis nicht gefunden. in /build/buildd/gtk+3.0-3.3.7+git20120108.69a52957/./gtk/gtkwidget.c (gdb) bt
+ Trace 229428
*** Bug 667883 has been marked as a duplicate of this bug. ***
I am reopening the bug. The patch as is makes gedit crash, but the crash can also be reproduced with testnotebookdnd. I think the patch should be reverted and the original problem re-analyzed: as far as I can see in the gtknotebook code the sequence is 1) drag_begin 2) real_remove 3) real_insert 4) drag_end the tab is reparented to the dnd window in (1) and before the patch it was unparented in (2) before being reparented to the new notebook in (3). With the patch 3 fails since the tab label still has the dnd window as parent.
Not sure if it's relevant, but the situation in the original crash involves drag_failed being called, which calls do_detach_tab, which is where things went south without my patch IIRC. In any case I agree things seem to be broken, so this needs more investigation and probably a minimal testcase.
I've reverted the patch now.
I'm attaching a minimal test case for the problematic scenario, namely when the drag is to the root window and there's no new notebook in question. On gtk 3.2.3 the test program throws the message Gtk-CRITICAL **: gtk_widget_unmap: assertion `GTK_IS_WIDGET (widget)' failed on dragging "page 2" onto the root window.
Created attachment 209366 [details] program to show error in GtkNotebook
I might add: there's doesn't appear to be any problem with this code using gtk 2.24.9.
Sorry, one more remark: this seems to be a non-fatal internal logic error. The test program I submitted goes on its merry way and does not crash. But the message is bad: it's likely to give an app developer the impression that he/she has misused the GTK API, but I'm pretty sure that's not the case.
I've pushed several noteook dnd fixes today, including crash fixes.