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 524772 - SIGSEGV in gtk_tooltip_show_tooltip
SIGSEGV in gtk_tooltip_show_tooltip
Status: RESOLVED DUPLICATE of bug 478519
Product: gtk+
Classification: Platform
Component: Widget: Other
2.12.x
Other Linux
: Normal critical
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2008-03-28 11:31 UTC by Pedro Villavicencio
Modified: 2008-09-29 15:18 UTC
See Also:
GNOME target: ---
GNOME version: 2.21/2.22


Attachments
Patch that fixes the bug (1.02 KB, patch)
2008-09-28 22:57 UTC, Gabriel Burt
none Details | Review

Description Pedro Villavicencio 2008-03-28 11:31:27 UTC
This bug has been filed here:

https://bugs.edge.launchpad.net/ubuntu/+source/gtk+2.0/+bug/208064

".

Thread 1 (process 2558)

  • #0 gtk_tooltip_show_tooltip
    at /build/buildd/gtk+2.0-2.12.9/gtk/gtktooltip.c line 865
  • #1 tooltip_popup_timeout
    at /build/buildd/gtk+2.0-2.12.9/gtk/gtktooltip.c line 993
  • #2 gdk_threads_dispatch
    at /build/buildd/gtk+2.0-2.12.9/gdk/gdk.c line 470
  • #3 g_timeout_dispatch
    at /build/buildd/glib2.0-2.16.1/glib/gmain.c line 3437
  • #4 IA__g_main_context_dispatch
    at /build/buildd/glib2.0-2.16.1/glib/gmain.c line 2003
  • #5 g_main_context_iterate
    at /build/buildd/glib2.0-2.16.1/glib/gmain.c line 2636
  • #6 IA__g_main_context_iteration
    at /build/buildd/glib2.0-2.16.1/glib/gmain.c line 2699
  • #7 processEvents
    at gconf.c line 1886
  • #8 ccsProcessEvents
    at main.c line 1729
  • #9 ??
    from /usr/lib/libwnck-1.so.22
  • #10 ??
  • #11 ??

Comment 1 Gabriel Burt 2008-09-28 02:08:51 UTC
I've seen this same trace while testing tooltips in Banshee on openSUSE 11.0 with gtk2 2.12.9-37.1.  Line 865 of gtktooltip.c in that gtk2 package is this:

if (tooltip->keyboard_mode_enabled)

So that means that

tooltip = g_object_get_data (G_OBJECT (display),
                   "gdk-display-current-tooltip");

is returning NULL, right?

I think for me, it may be caused by in my OnQueryTooltip handler I'm currently (sometimes) setting the TipArea to something incorrect (outside the height/width of the screen).  Still, Gtk+ should probably be hardened against this, right?
Comment 2 Gabriel Burt 2008-09-28 02:26:47 UTC
Hrm, setting the rect x/y to a huge value (8123, for example) doesn't cause the crash.  Must be something else - maybe alternating setting it to a valid value and an invalid one.
Comment 3 Gabriel Burt 2008-09-28 19:12:26 UTC
I think the problem may be that in gtktooltip.c in the function gtk_tooltip_start_delay, the timeout_id is checked and that timeout removed if set, but the same isn't done for the browse_mode_timeout_id, whose callback destroys the tooltip.

It's bothering me that we don't see this all the time in other apps though; I wonder if I'm still doing something wrong/different than other gtktooptip users in my code.

CC'ing Kristian since he's the gtktooltip.c expert. :)
Comment 4 Gabriel Burt 2008-09-28 21:14:02 UTC
I patched gtktooltip.c and ran it, and it seems my thinking above was right.

Here's some debugging output I patched in.  You can see that start_delay is called, then browse_mode_expired (b/c the browse_mode_timeout_id wasn't 0) runs and destroys the tooltip, then the show_tooltip is run but the tooltip is now NULL.

gtktooltip.c: gtk_tooltip_start_delay, browse_mode_timeout_id = 215
gtktooltip.c: tooltip_browse_mode_expired
gtktooltip.c: gtk_tooltip_show_tooltip, tooltip is NULL, would have crashed here without this if statement
Comment 5 Gabriel Burt 2008-09-28 22:57:19 UTC
Created attachment 119551 [details] [review]
Patch that fixes the bug

This patch adds NULL checking in two places, removes the browse_mode_timeout if set in gtk_tooltip_start_delay - and properly sets the timeout_ids to 0 when removed in gtk_tooltip_start_delay.  AFAICT, this fixes the crasher I was seeing before.
Comment 6 Kristian Rietveld 2008-09-29 12:52:48 UTC
(In reply to comment #3)
> I think the problem may be that in gtktooltip.c in the function
> gtk_tooltip_start_delay, the timeout_id is checked and that timeout removed if
> set, but the same isn't done for the browse_mode_timeout_id, whose callback
> destroys the tooltip.

If the tooltip is destroyed, the finalize method of the tooltip will unset both timeouts, so gtk_tooltip_show_tooltip() will never be called.  (Maybe this suggests a ref counting issue?)  Even though we might not want to destroy the tooltip from the browse mode timeout when a normal timeout is pending, destroying the tooltip from the browse mode timeout should not crash the application at this point.

> It's bothering me that we don't see this all the time in other apps though; I
> wonder if I'm still doing something wrong/different than other gtktooptip users
> in my code.

I actually want to get to the bottom of what is wrong here.  The stack trace of the bug report suggests that this problem also turns up in libwnck's window pager.  (But I can't see what would be wrong in there).


Do you have any more observations, suggestions?  As always stand-alone test cases are appreciated ;)  But I guess you don't have a clue on one either at the moment ...
Comment 7 Kristian Rietveld 2008-09-29 12:56:12 UTC

*** This bug has been marked as a duplicate of 478519 ***
Comment 8 Gabriel Burt 2008-09-29 15:08:45 UTC
The part of my patch setting the timeout_ids to 0 and removing the browse_mode callback is still worth committing, isn't it?  Should I open a new bug for it?

It does seem like the finalizer should be getting run and preventing the segfaults.  I'll see if I can tell if the finalizer is getting run when it should from my C# app.
Comment 9 Kristian Rietveld 2008-09-29 15:18:06 UTC
(In reply to comment #8)
> The part of my patch setting the timeout_ids to 0 and removing the browse_mode
> callback is still worth committing, isn't it?  Should I open a new bug for it?

The browse mode timeout should not be removed from gtk_tooltip_start_delay().  In case that tooltip popup is cancelled and another attempt is made, the browse mode might still be effective.