After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 722616 - Segfault on window close due to mangled location entry pointer
Segfault on window close due to mangled location entry pointer
Status: RESOLVED DUPLICATE of bug 741952
Product: nautilus
Classification: Core
Component: Crashers
3.12.x
Other Linux
: Normal normal
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
: 719558 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2014-01-20 16:48 UTC by Michael Cronenworth
Modified: 2014-12-27 00:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Location entry pointer check (760 bytes, patch)
2014-01-20 16:48 UTC, Michael Cronenworth
needs-work Details | Review
Check for valid location entry widget #2 (1.13 KB, patch)
2014-01-23 21:53 UTC, Michael Cronenworth
committed Details | Review

Description Michael Cronenworth 2014-01-20 16:48:21 UTC
Created attachment 266757 [details] [review]
Location entry pointer check

See RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1013272

Nautilus crashes on close when more than one tabs are open.

After some debugging I observed that nautilus is attempting to update the location entry widget when each tab is closed, but the widget has been mangled by the window being destroyed and is no longer valid.

The attached patch adds a simple NULL check and widget test that keeps nautilus from crashing for me.
Comment 1 Igor Gnatenko 2014-01-20 17:28:46 UTC
Review of attachment 266757 [details] [review]:

Looks good, but needs some rework.
- codestyle: you must use tabs instead of spaces (take a look at near code)
- codestyle: closing ")" should be w/o/ spaces before
- codestyle: opening "(" in GTK_IS_WIDGET should has space before
- patch: would be good if you will attach patch, did w/ git format-patch

BTW, this is default checkings. Nautilus maintainers should review this patch in the near future ;)
Comment 2 Michael Cronenworth 2014-01-23 21:53:45 UTC
Created attachment 267080 [details] [review]
Check for valid location entry widget #2

(In reply to comment #1)
> - codestyle: you must use tabs instead of spaces (take a look at near code)
> - codestyle: closing ")" should be w/o/ spaces before
> - codestyle: opening "(" in GTK_IS_WIDGET should has space before
I did this work in my personal editor as a quick trial. I wasn't planning on meeting Gnome code formatting. Updated.
> - patch: would be good if you will attach patch, did w/ git format-patch
I didn't believe a one (two technically) line patch would require a full review and would rather it be fixed without my name attached, but I will attach a new patch so that this does get fixed.

> BTW, this is default checkings. Nautilus maintainers should review this patch
> in the near future ;)

Thanks.
Comment 3 Michael Catanzaro 2014-02-06 16:58:09 UTC
Review of attachment 267080 [details] [review]:

::: src/nautilus-window.c
@@ +1034,2 @@
 		location_entry = nautilus_toolbar_get_location_entry (NAUTILUS_TOOLBAR (window->details->toolbar));
+		if (location_entry != NULL && GTK_IS_WIDGET (location_entry)) {

I don't think the GTK_IS_WIDGET is needed here
Comment 4 Michael Cronenworth 2014-02-06 17:00:10 UTC
(In reply to comment #3)
> I don't think the GTK_IS_WIDGET is needed here

I've seen a case where a non-null pointer was passed but it was no longer pointing to a valid widget (destroyed).
Comment 5 Michael Catanzaro 2014-02-06 17:35:37 UTC
Er, right, like you said in the first post.

I've pushed this since it's clearly harmless and since I've hit this crash multiple times, but I'll leave the bug open in case a Nautilus developer wants to investigate further.  Thanks!
Comment 6 Debarshi Ray 2014-03-21 10:49:34 UTC
Why was this only pushed to the gnome-3-8 branch?
Comment 8 Michael Catanzaro 2014-03-21 14:40:10 UTC
The bug is still open because I haven't checked if there's not a race.

This stopped all the Fedora retrace reports [1], but there's a user in the downstream bug who says he still got it.

[1] https://retrace.fedoraproject.org/faf/problems/1490268/
Comment 9 Debarshi Ray 2014-03-21 14:41:48 UTC
(In reply to comment #7)
> Debarashi, here's the gnome-3-10 commit:
> 
> https://git.gnome.org/browse/nautilus/commit/?h=gnome-3-10&id=67ba854074ac48ec142bdf3b9848cb8d94070f82
> 
> and the master commit:
> 
> https://git.gnome.org/browse/nautilus/commit/?id=8acef3c776f2ef4f5dac788ed81f7e2d1f504026

Oh, right. Sorry about that. I had a stale Git checkout.
Comment 10 Marius Gedminas 2014-05-20 08:35:23 UTC
I just got Nautilus 3.12 to segfault when I tried to close a window with three tabs in it.  I think it's the same bug.

Here's the stack trace:

  • #0 g_type_check_instance_cast
    at /build/buildd/glib2.0-2.40.0/./gobject/gtype.c line 4003
  • #1 nautilus_window_sync_location_widgets
    at nautilus-window.c line 1034
  • #2 real_active
    at nautilus-window-slot.c line 572
  • #3 g_closure_invoke
    at /build/buildd/glib2.0-2.40.0/./gobject/gclosure.c line 768
  • #4 signal_emit_unlocked_R
    at /build/buildd/glib2.0-2.40.0/./gobject/gsignal.c line 3589
  • #5 g_signal_emit_valist
    at /build/buildd/glib2.0-2.40.0/./gobject/gsignal.c line 3307
  • #6 g_signal_emit_by_name
    at /build/buildd/glib2.0-2.40.0/./gobject/gsignal.c line 3403
  • #7 g_closure_invoke
    at /build/buildd/glib2.0-2.40.0/./gobject/gclosure.c line 768
  • #8 signal_emit_unlocked_R
    at /build/buildd/glib2.0-2.40.0/./gobject/gsignal.c line 3551
  • #9 g_signal_emit_valist
    at /build/buildd/glib2.0-2.40.0/./gobject/gsignal.c line 3307
  • #10 g_signal_emit
    at /build/buildd/glib2.0-2.40.0/./gobject/gsignal.c line 3363
  • #11 gtk_notebook_switch_page
    at /build/buildd/gtk+3.0-3.12.2/./gtk/gtknotebook.c line 6785
  • #12 gtk_notebook_real_remove
    at /build/buildd/gtk+3.0-3.12.2/./gtk/gtknotebook.c line 5049
  • #13 gtk_notebook_remove
    at /build/buildd/gtk+3.0-3.12.2/./gtk/gtknotebook.c line 4214
  • #14 nautilus_notebook_remove
    at nautilus-notebook.c line 465
  • #15 g_cclosure_marshal_VOID__OBJECTv
    at /build/buildd/glib2.0-2.40.0/./gobject/gmarshal.c line 1312
  • #16 _g_closure_invoke_va
    at /build/buildd/glib2.0-2.40.0/./gobject/gclosure.c line 831
  • #17 g_signal_emit_valist
    at /build/buildd/glib2.0-2.40.0/./gobject/gsignal.c line 3215
  • #18 g_signal_emit
    at /build/buildd/glib2.0-2.40.0/./gobject/gsignal.c line 3363
  • #19 gtk_container_remove
    at /build/buildd/gtk+3.0-3.12.2/./gtk/gtkcontainer.c line 1619
  • #20 g_list_foreach
    at /build/buildd/glib2.0-2.40.0/./glib/glist.c line 993
  • #21 nautilus_window_destroy
    at nautilus-window.c line 1602
  • #22 g_closure_invoke
    at /build/buildd/glib2.0-2.40.0/./gobject/gclosure.c line 768
  • #23 signal_emit_unlocked_R
    at /build/buildd/glib2.0-2.40.0/./gobject/gsignal.c line 3667
  • #24 g_signal_emit_valist
    at /build/buildd/glib2.0-2.40.0/./gobject/gsignal.c line 3307
  • #25 g_signal_emit
    at /build/buildd/glib2.0-2.40.0/./gobject/gsignal.c line 3363
  • #26 gtk_widget_dispose
    at /build/buildd/gtk+3.0-3.12.2/./gtk/gtkwidget.c line 11357
  • #27 gtk_window_dispose
    at /build/buildd/gtk+3.0-3.12.2/./gtk/gtkwindow.c line 2684
  • #28 gtk_application_window_dispose
    at /build/buildd/gtk+3.0-3.12.2/./gtk/gtkapplicationwindow.c line 774
  • #29 g_object_run_dispose
    at /build/buildd/glib2.0-2.40.0/./gobject/gobject.c line 1073
  • #30 nautilus_window_delete_event
    at nautilus-window.c line 2085
  • #31 _gtk_marshal_BOOLEAN__BOXEDv
    at /build/buildd/gtk+3.0-3.12.2/./gtk/gtkmarshalers.c line 130
  • #32 _g_closure_invoke_va
    at /build/buildd/glib2.0-2.40.0/./gobject/gclosure.c line 831
  • #33 g_signal_emit_valist
    at /build/buildd/glib2.0-2.40.0/./gobject/gsignal.c line 3215
  • #34 g_signal_emit
    at /build/buildd/glib2.0-2.40.0/./gobject/gsignal.c line 3363
  • #35 gtk_widget_event_internal
    at /build/buildd/gtk+3.0-3.12.2/./gtk/gtkwidget.c line 7229
  • #36 gtk_widget_event
    at /build/buildd/gtk+3.0-3.12.2/./gtk/gtkwidget.c line 6891
  • #37 gtk_main_do_event
    at /build/buildd/gtk+3.0-3.12.2/./gtk/gtkmain.c line 1617
  • #38 gdk_event_source_dispatch
    at /build/buildd/gtk+3.0-3.12.2/./gdk/x11/gdkeventsource.c line 364
  • #39 g_main_dispatch
    at /build/buildd/glib2.0-2.40.0/./glib/gmain.c line 3064
  • #40 g_main_context_dispatch
    at /build/buildd/glib2.0-2.40.0/./glib/gmain.c line 3663
  • #41 g_main_context_iterate
    at /build/buildd/glib2.0-2.40.0/./glib/gmain.c line 3734
  • #42 g_main_context_iteration
    at /build/buildd/glib2.0-2.40.0/./glib/gmain.c line 3795
  • #43 g_application_run
    at /build/buildd/glib2.0-2.40.0/./gio/gapplication.c line 2114
  • #44 main
    at nautilus-main.c line 103

Originally filed at https://bugs.launchpad.net/ubuntu-gnome/+bug/1321184 (which is a private bug at the moment).
Comment 11 Michael Catanzaro 2014-08-27 01:31:35 UTC
*** Bug 719558 has been marked as a duplicate of this bug. ***
Comment 12 Michael Catanzaro 2014-08-27 03:50:30 UTC


  • #19 gtk_container_remove
    at /build/buildd/gtk+3.0-3.12.2/./gtk/gtkcontainer.c line 1619
  • #20 g_list_foreach
    at /build/buildd/glib2.0-2.40.0/./glib/glist.c line 993
  • #21 nautilus_window_destroy
    at nautilus-window.c line 1602

Did it optimize away entire function calls? g_list_foreach() should have called destroy_slots_foreach(), not gtk_container_remove()....
Comment 13 Nelson Benitez 2014-12-26 21:01:20 UTC
This bug is same as bug 741952 which I've just attached a patch for (I would have attached here if I knew this bug beforehand), I think that fixes the root problem, while the patch committed here was only fixing bug symptom.

In fact the new crashes where happening in next lines below the patched code, this time when accessing the nautilus path bar, because the real problem is that the function where the crashes are happening (nautilus_window_sync_location_widgets()) should not be called at all in this context.

It was called as part of real_active() function which makes a slot active, this is normally good behaviour that when closing a tab to activate the next free one, but *not* when we are closing all tabs (as part of window closing).

So while commit 8acef3c776f2ef4f5dac788ed81f7e2d1f504026 could be reverted, it's not strictly necessary as it's also harmless.
Comment 14 Michael Catanzaro 2014-12-27 00:23:31 UTC
> So while commit 8acef3c776f2ef4f5dac788ed81f7e2d1f504026 could be reverted,
> it's not strictly necessary as it's also harmless.

Let's revert it, since it was incorrect. Sorry about that.

*** This bug has been marked as a duplicate of bug 741952 ***