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 515017 - Crash in my code
Crash in my code
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Class: UIManager / Actions
2.12.x
Other All
: Normal critical
: ---
Assigned To: Sven Herzberg
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2008-02-07 16:26 UTC by Sven Herzberg
Modified: 2008-02-08 00:30 UTC
See Also:
GNOME target: ---
GNOME version: 2.19/2.20


Attachments
Testcase (1.20 KB, text/plain)
2008-02-07 16:27 UTC, Sven Herzberg
  Details
Proposed Patch (1.49 KB, patch)
2008-02-08 00:21 UTC, Sven Herzberg
committed Details | Review

Description Sven Herzberg 2008-02-07 16:26:25 UTC
Steps to reproduce:
1. download the attached source file
2. compile it (gcc -o test main.c `pkg-config --cflags --libs gtk+-2.0`)
3. execute it


Stack trace:
  • #0 _gtk_action_sync_menu_visible
    at /build/buildd/gtk+2.0-2.12.0/gtk/gtkaction.c line 649
  • #1 update_smart_separators
    at /build/buildd/gtk+2.0-2.12.0/gtk/gtkuimanager.c line 2173
  • #2 IA__g_cclosure_marshal_VOID__PARAM
    at /build/buildd/glib2.0-2.14.1/gobject/gmarshal.c line 531
  • #3 IA__g_closure_invoke
    at /build/buildd/glib2.0-2.14.1/gobject/gclosure.c line 490
  • #4 signal_emit_unlocked_R
    at /build/buildd/glib2.0-2.14.1/gobject/gsignal.c line 2440
  • #5 IA__g_signal_emit_valist
    at /build/buildd/glib2.0-2.14.1/gobject/gsignal.c line 2199
  • #6 IA__g_signal_emit
    at /build/buildd/glib2.0-2.14.1/gobject/gsignal.c line 2243
  • #7 g_object_dispatch_properties_changed
    at /build/buildd/glib2.0-2.14.1/gobject/gobject.c line 563
  • #8 g_object_notify_dispatcher
    at /build/buildd/glib2.0-2.14.1/gobject/gobject.c line 245
  • #9 IA__g_object_notify
    at /build/buildd/glib2.0-2.14.1/gobject/gobjectnotifyqueue.c line 123
  • #10 IA__gtk_widget_hide
    at /build/buildd/gtk+2.0-2.12.0/gtk/gtkwidget.c line 3027
  • #11 _gtk_action_sync_menu_visible
    at /build/buildd/gtk+2.0-2.12.0/gtk/gtkaction.c line 654
  • #12 _gtk_action_sync_visible
    at /build/buildd/gtk+2.0-2.12.0/gtk/gtkaction.c line 1240
  • #13 IA__gtk_action_set_visible
    at /build/buildd/gtk+2.0-2.12.0/gtk/gtkaction.c line 1276
  • #14 main


Other information:
If you change "GameResume" into "GamePause" (line 43) everything works.
Comment 1 Sven Herzberg 2008-02-07 16:27:04 UTC
Created attachment 104648 [details]
Testcase
Comment 2 Laurent Belmonte 2008-02-07 16:59:57 UTC
Same crash here ( ubuntu 7.04 and ubuntu 8.04 )
Crash occure with any actions ( tested with "GamePause","GameStop" and "GameNew1Player")
Comment 3 Christian Persch 2008-02-07 17:58:51 UTC
<popup name='game_menu'> is missing a GtkAction for the popup menu.
Comment 4 Sven Herzberg 2008-02-07 18:34:13 UTC
According to the DTD, it is not required:
http://library.gnome.org/devel/gtk/stable/GtkUIManager.html#XML-UI

If you think the DTD is wrong, then the parser in GtkUIManager is wrong too:
 * "<menuitem />" will give this warning:
   (monkey-bubble:16314): Gtk-WARNING **: menuitem: missing action (null)
 * "<popup />" doesn't give any warning:

So either the DTD _and_ the parsing code are both wrong. I actually don't think that a popup is an "action" as well as I don't think of menubars as "actions". And, menubars also never get actions assigned in the example code from the documentation.

More pointers:

No action for a menubar:
http://library.gnome.org/devel/gtk/stable/GtkUIManager.html#id3477610

No actions for a menubar nor for a toolbar:
http://svn.gnome.org/viewvc/gtk%2B/trunk/demos/gtk-demo/ui_manager.c?annotate=16908
(lines 106ff)
Comment 5 Matthias Clasen 2008-02-07 18:42:09 UTC
If the dtd and the code disagree, the dtd is wrong. 
Comment 6 Sven Herzberg 2008-02-08 00:21:34 UTC
Created attachment 104675 [details] [review]
Proposed Patch

May I commit this one?
Comment 7 Matthias Clasen 2008-02-08 00:23:24 UTC
Please commit to both branches, thanks
Comment 8 Sven Herzberg 2008-02-08 00:30:32 UTC
Committed to trunk and gtk-2-12

2008-02-08  Sven Herzberg  <sven@imendio.com>                                                                  

>-------Adjust the code to match the documentation, examples, "common sense"
>-------and existing applications.

>-------* gtk/gtkaction.c: (_gtk_action_sync_menu_visible): take into account
>-------that a GtkMenu for a <popup> element doesn't have to have a GtkAction
>-------assigned