gtk-builder-convert crashes when converting menus

Bug #214267 reported by anonymoose
26
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GTK+
Fix Released
Medium
gtk+2.0 (Ubuntu)
Fix Released
Low
Ubuntu Desktop Bugs

Bug Description

Hi,

I think what I have is the same bug. The trace seems to confirm the remarks from James White.

This is the info I get:

  File "/usr/bin/gtk-builder-convert", line 745, in <module>
    sys.exit(main(sys.argv))
  File "/usr/bin/gtk-builder-convert", line 733, in main
    conv.parse_file(input_filename)
  File "/usr/bin/gtk-builder-convert", line 161, in parse_file
    self._parse()
  File "/usr/bin/gtk-builder-convert", line 259, in _parse
    self._convert(node.getAttribute("class"), node)
  File "/usr/bin/gtk-builder-convert", line 284, in _convert
    self._convert_menu(node)
  File "/usr/bin/gtk-builder-convert", line 342, in _convert_menu
    item = self._convert_menuitem(uimgr, obj_node)
  File "/usr/bin/gtk-builder-convert", line 378, in _convert_menuitem
    item = self._convert_menuitem(uimgr, obj_node)
  File "/usr/bin/gtk-builder-convert", line 374, in _convert_menuitem
    self._add_action_from_menuitem(uimgr, obj_node)
  File "/usr/bin/gtk-builder-convert", line 425, in _add_action_from_menuitem
    properties['stock_id'] = child
UnboundLocalError: local variable 'child' referenced before assignment

THIS ONLY HAPPENS WHEN I AM CONVERTING AN APPLICATION WITH A MENU BAR

Running ubuntu hardy LTS
any help would be great thanks!

ProblemType: Crash
Architecture: amd64
Date: Tue Apr 8 18:20:47 2008
DistroRelease: Ubuntu 8.04
ExecutablePath: /usr/bin/gtk-builder-convert
InterpreterPath: /usr/bin/python2.5
NonfreeKernelModules: ath_hal nvidia
Package: libgtk2.0-dev 2.12.9-2ubuntu2
PackageArchitecture: amd64
ProcCmdline: python /usr/bin/gtk-builder-convert tutorial.glade tutorial.xml
ProcEnviron:
 SHELL=/bin/bash
 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
 LANG=en_US.UTF-8
PythonArgs: ['/usr/bin/gtk-builder-convert', 'tutorial.glade', 'tutorial.xml']
SourcePackage: gtk+2.0
Title: gtk-builder-convert crashed with UnboundLocalError in _add_action_from_menuitem()
Uname: Linux 2.6.24-15-generic x86_64
UserGroups: adm admin audio cdrom dialout dip floppy fuse lpadmin plugdev video

Tags: apport-crash
Revision history for this message
anonymoose (anonymoose313) wrote :
Revision history for this message
benthurston27 (benthurston27) wrote :

I am on amd64/hardy/gtk2.0/python2.5 as well and get the same error message i think with the same glade file being converted.

Revision history for this message
James White (frozenjim) wrote :

Hi, another newb with the same problem.

I commented out all of the menuitem in my .glade file and it built and compiled fine. Then I moved my comment lines until I isolated the problem.

Glade is adding a property called "use_stock" to the GtkImageMenuItem that doesn't seem to belong. By commenting out that property line, everything works fine (at least so far as I have coded - my menus don't actually DO anything yet).

[code]
<child>
   <widget class="GtkImageMenuItem" id="new_menu_item">
      <property name="visible">True</property>
      <property name="label" translatable="yes">gtk-new</property>
      <property name="use_underline">True</property>
<!--<property name="use_stock">True</property> -->
   </widget>
</child>[/code]

Rocky Road (m-baert)
description: updated
Revision history for this message
Phil Housley (undeconstructed) wrote :

The best fix I've found for is changing the convert script at line 425 to read:

properties['stock_id'] = get_property_node(node, 'label')

I don't know if that's what was intended originally, but the script seems to refer to things my glade files never contain.

Revision history for this message
Sebastien Bacher (seb128) wrote :

the bug is similar to http://bugzilla.gnome.org/show_bug.cgi?id=523932 and should be fixed in intrepid, feel free to reopen if you still get the issue though

Changed in gtk+2.0:
assignee: nobody → desktop-bugs
importance: Undecided → Low
status: New → Fix Released
Changed in gtk:
status: Unknown → Fix Released
Revision history for this message
frankzhu (frank-zhu-mingyu) wrote :

this is still a problem, i am using hardy on amd64.

Revision history for this message
Adam Plumb (adamplumb) wrote :

It would be really nice if the fix in the current gtk-builder-convert python script could be backported to Hardy.

Changed in gtk:
importance: Unknown → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.