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 673822 - nautilus crashed with SIGSEGV in _gdk_device_xi2_reset_scroll_valuators()
nautilus crashed with SIGSEGV in _gdk_device_xi2_reset_scroll_valuators()
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Backend: X11
3.4.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
: 685403 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-04-10 09:20 UTC by Sebastien Bacher
Modified: 2016-03-06 03:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[PATCH] gdk/x11/gdkdevicemanager-xi2.c: Only call `_gdk_device_xi2_reset_scroll_valuators` with non-NULL argument (2.82 KB, patch)
2013-02-01 11:13 UTC, Paul Menzel
reviewed Details | Review
[PATCH] gdk/x11/gdkdevice-xi2.c: Check pointer argument for being non-NULL (1.05 KB, patch)
2013-02-01 11:22 UTC, Paul Menzel
reviewed Details | Review

Description Sebastien Bacher 2012-04-10 09:20:26 UTC
The bug has been reported in https://bugs.launchpad.net/ubuntu/+source/gtk+3.0/+bug/952546

"stracktrace from gtk 3.3.18

  • #0 _gdk_device_xi2_reset_scroll_valuators
    at /build/buildd/gtk+3.0-3.3.18/./gdk/x11/gdkdevice-xi2.c line 862
  • #1 gdk_x11_device_manager_xi2_translate_event
    at /build/buildd/gtk+3.0-3.3.18/./gdk/x11/gdkdevicemanager-xi2.c line 1542
  • #2 gdk_x11_device_manager_xi2_translate_event
    at /build/buildd/gtk+3.0-3.3.18/./gdk/x11/gdkdevicemanager-xi2.c line 1105
  • #3 _gdk_x11_event_translator_translate
    at /build/buildd/gtk+3.0-3.3.18/./gdk/x11/gdkeventtranslator.c line 51
  • #4 gdk_event_source_translate_event
    at /build/buildd/gtk+3.0-3.3.18/./gdk/x11/gdkeventsource.c line 227
  • #5 _gdk_x11_display_queue_events
    at /build/buildd/gtk+3.0-3.3.18/./gdk/x11/gdkeventsource.c line 332
  • #6 gdk_display_get_event
    at /build/buildd/gtk+3.0-3.3.18/./gdk/gdkdisplay.c line 310
  • #7 gdk_event_source_dispatch
    at /build/buildd/gtk+3.0-3.3.18/./gdk/x11/gdkeventsource.c line 354
  • #8 g_main_dispatch
    at /build/buildd/glib2.0-2.31.20/./glib/gmain.c line 2510
  • #9 g_main_context_dispatch
    at /build/buildd/glib2.0-2.31.20/./glib/gmain.c line 3047

Comment 1 Sebastien Bacher 2012-04-10 09:22:25 UTC
The most recent duplicate uses gtk 3.4.0, note that all the bugs seem to come from nautilus so it could be a nautilus issue...
Comment 2 Sebastien Bacher 2012-04-18 11:50:18 UTC
that seems a quite comment bug, the launchpad bug got 21 duplicates
Comment 3 Milan Crha 2013-02-01 08:02:59 UTC
*** Bug 685403 has been marked as a duplicate of this bug. ***
Comment 4 Milan Crha 2013-02-01 08:05:50 UTC
Similar downstream bug report from gtk3-3.6.4:
https://bugzilla.redhat.com/show_bug.cgi?id=906384

Core was generated by `/usr/bin/evolution'.
Program terminated with signal 11, Segmentation fault.
0  _gdk_device_xi2_reset_scroll_valuators (device=device@entry=0x0) at gdkdevice-xi2.c:853
853	  for (i = 0; i < device->scroll_valuators->len; i++)


Thread 1 (Thread 0x7f2b3b2d0a00 (LWP 4306))

  • #0 _gdk_device_xi2_reset_scroll_valuators
    at gdkdevice-xi2.c line 853
  • #1 gdk_x11_device_manager_xi2_translate_event
    at gdkdevicemanager-xi2.c line 1551
  • #2 gdk_x11_device_manager_xi2_translate_event
    at gdkdevicemanager-xi2.c line 1101
  • #3 _gdk_x11_event_translator_translate
    at gdkeventtranslator.c line 51
  • #4 gdk_event_source_translate_event
    at gdkeventsource.c line 227
  • #5 _gdk_x11_display_queue_events
    at gdkeventsource.c line 332
  • #6 gdk_display_get_event
    at gdkdisplay.c line 310
  • #7 gdk_event_source_dispatch
    at gdkeventsource.c line 354
  • #8 g_main_dispatch
    at gmain.c line 2715
  • #9 g_main_context_dispatch
    at gmain.c line 3219
  • #10 g_main_context_iterate
    at gmain.c line 3290
  • #11 g_main_loop_run
    at gmain.c line 3484
  • #12 gtk_dialog_run
    at gtkdialog.c line 1110
  • #13 e_alert_run_dialog
    at e-alert-dialog.c line 343
  • #14 e_alert_run_dialog_for_args
    at e-alert-dialog.c line 364
  • #15 delete_component_dialog
    at delete-comp.c line 158
  • #16 e_calendar_view_delete_selected_occurrence
    at e-calendar-view.c line 1392
  • #17 g_closure_invoke
    at gclosure.c line 777
  • #18 signal_emit_unlocked_R
    at gsignal.c line 3551
  • #19 g_signal_emit_valist
    at gsignal.c line 3300
  • #20 g_signal_emit
    at gsignal.c line 3356
  • #21 _gtk_action_emit_activate
    at gtkaction.c line 801
  • #22 g_closure_invoke
    at gclosure.c line 777
  • #23 signal_emit_unlocked_R
    at gsignal.c line 3551
  • #24 g_signal_emit_valist
    at gsignal.c line 3300
  • #25 g_signal_emit
    at gsignal.c line 3356
  • #26 _gtk_action_emit_activate
    at gtkaction.c line 801
  • #27 g_closure_invoke
    at gclosure.c line 777
  • #28 signal_emit_unlocked_R
    at gsignal.c line 3481
  • #29 g_signal_emit_valist
    at gsignal.c line 3300
  • #30 g_signal_emit
    at gsignal.c line 3356
  • #31 gtk_widget_activate
    at gtkwidget.c line 6334
  • #32 gtk_menu_shell_activate_item
    at gtkmenushell.c line 1429
  • #33 gtk_menu_shell_button_release
    at gtkmenushell.c line 830
  • #34 _gtk_marshal_BOOLEAN__BOXEDv
    at gtkmarshalers.c line 130
  • #35 _g_closure_invoke_va
    at gclosure.c line 840
  • #36 g_signal_emit_valist
    at gsignal.c line 3211
  • #37 g_signal_emit
    at gsignal.c line 3356
  • #38 gtk_widget_event_internal
    at gtkwidget.c line 6303
  • #39 gtk_widget_event
    at gtkwidget.c line 5960
  • #40 propagate_event_up
    at gtkmain.c line 2397
  • #41 propagate_event
    at gtkmain.c line 2505
  • #42 gtk_main_do_event
    at gtkmain.c line 1720
  • #43 gdk_event_source_dispatch
    at gdkeventsource.c line 358
  • #44 g_main_dispatch
    at gmain.c line 2715
  • #45 g_main_context_dispatch
    at gmain.c line 3219
  • #46 g_main_context_iterate
    at gmain.c line 3290
  • #47 g_main_loop_run
    at gmain.c line 3484
  • #48 gtk_main
    at gtkmain.c line 1160
  • #49 main
    at main.c line 711

Comment 5 Paul Menzel 2013-02-01 11:07:45 UTC
The Debian BTS tracks this issue under bug 699531 [1].

[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=699531
Comment 6 Paul Menzel 2013-02-01 11:10:33 UTC
The Debian BTS tracks this issue under bug 699531 [1].

[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=699531
Comment 7 Paul Menzel 2013-02-01 11:10:41 UTC
The Debian BTS tracks this issue under bug 699531 [1].

[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=699531
Comment 8 Paul Menzel 2013-02-01 11:12:00 UTC
Sorry for the two superfluous posts. Bugzilla took over a minute to respond. :(
Comment 9 Paul Menzel 2013-02-01 11:13:12 UTC
Created attachment 234958 [details] [review]
[PATCH] gdk/x11/gdkdevicemanager-xi2.c: Only call `_gdk_device_xi2_reset_scroll_valuators` with non-NULL argument

From 6bad241ae3b13200ca7a5741471927c81d220434 Mon Sep 17 00:00:00 2001
From: Paul Menzel <paulepanter@users.sourceforge.net>
Date: Fri, 1 Feb 2013 11:55:02 +0100
Subject: [PATCH] gdk/x11/gdkdevicemanager-xi2.c: Only call `_gdk_device_xi2_reset_scroll_valuators` with non-NULL argument

Due to

    commit 013da47a07d70ee40eab211850b4238f3fdb4b25
    Author: Carlos Garnacho <carlosg@gnome.org>
    Date:   Thu Feb 23 18:24:37 2012 +0100

        gdk,xi2: Ensure scroll valuators are reset on window/device switch

Evolution and Nautilus could crash due to a NULL pointer
dereference in `device->scroll_valuators->len`
in `_gdk_device_xi2_reset_scroll_valuators`.

        $ more gdk/x11/gdkdevice-xi2.c
        […]
        void
        _gdk_device_xi2_reset_scroll_valuators (GdkX11DeviceXI2 *device)
        {
          guint i;

          for (i = 0; i < device->scroll_valuators->len; i++)
            {
              ScrollValuator *scroll;

              scroll = &g_array_index (device->scroll_valuators, ScrollValuator, i);
              scroll->last_value_valid = FALSE;
            }
        }
        […]

This was possible because `g_hash_table_lookup` can return NULL [1]
which needs to be checked.

        Thread 1 (Thread 0xb5527890 (LWP 4212)):
        #0  0xb62492f4 in _gdk_device_xi2_reset_scroll_valuators (device=device@entry=0x0)
            at /build/buildd-gtk+3.0_3.4.2-4-i386-QQNfyz/gtk+3.0-3.4.2/./gdk/x11/gdkdevice-xi2.c:853
                i = 0

The reason for the non-existance of the value in the hash table needs
further checking.

This issue is present since release 3.3.18.

        $ git tag --contains 013da47a | head -3
        3.3.18
        3.3.20
        3.4.0

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

[1] http://developer.gnome.org/glib/2.29/glib-Hash-Tables.html#g-hash-table-lookup
---
 gdk/x11/gdkdevicemanager-xi2.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Comment 10 Paul Menzel 2013-02-01 11:22:15 UTC
Created attachment 234959 [details] [review]
[PATCH] gdk/x11/gdkdevice-xi2.c: Check pointer argument for being non-NULL

From 7d46eabd5ed83b473fe45156ab43b70e1aac5016 Mon Sep 17 00:00:00 2001
From: Paul Menzel <paulepanter@users.sourceforge.net>
Date: Fri, 1 Feb 2013 12:16:46 +0100
Subject: [PATCH] gdk/x11/gdkdevice-xi2.c: Check pointer argument for being non-NULL

As the pointer `device` is dereferenced in the for loop, the pointer needs
to be checked for being non-NULL. While at it, also check if the pointer is
an X11 XI2 device.

Similar checks are also done in `_gdk_x11_device_xi2_get_id`.

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=673822
---
 gdk/x11/gdkdevice-xi2.c |    3 +++
 1 file changed, 3 insertions(+)
Comment 11 Luf 2013-02-28 08:24:48 UTC
It seems these patches helps me on Fedora 18.
Thanks Paul for them.
Comment 12 Emmanuele Bassi (:ebassi) 2013-02-28 11:46:06 UTC
Review of attachment 234959 [details] [review]:

::: gdk/x11/gdkdevice-xi2.c
@@ +852,3 @@
 
+  g_return_if_fail (device != NULL);
+  g_return_if_fail (GDK_IS_X11_DEVICE_XI2 (device));

we usually don't use g_return_* in private API: either use g_assert(), and catch the callers that use a NULL device, or do an explicit check and return without a warning.

on stable releases, g_return_* will also evaluate to nothing, so it's doubtful it would help you.

my personal preference is for the assertion failure, and figuring out why _gdk_device_xi2_reset_scroll_valuators() is being called with a NULL or an invalid device.
Comment 13 Emmanuele Bassi (:ebassi) 2013-02-28 11:48:47 UTC
Review of attachment 234958 [details] [review]:

::: gdk/x11/gdkdevicemanager-xi2.c
@@ +1548,3 @@
         source_device = g_hash_table_lookup (device_manager->id_table,
                                              GUINT_TO_POINTER (xev->sourceid));
+        if (source_device) {

coding style: braces on a new line; indentation is 2 spaces.

@@ +1551,3 @@
+                gdk_event_set_source_device (event, source_device);
+                _gdk_device_xi2_reset_scroll_valuators (GDK_X11_DEVICE_XI2 (source_device));
+        }

this block is weird: it means we're receiving an event with a device that is not valid any more, or that we're receiving an event that is out of order.

given the object lifetime management issues of X11, this may be a case of the former, which means we should ignore the event, not emit an event without a source device attached to it.
Comment 14 Matthias Clasen 2016-03-06 03:26:06 UTC
this is not happening anymore