[ wxwindows-Bugs-1874290 ] Debugging code with a menu bar crashes
program...
SourceForge.net
noreply at sourceforge.net
Fri Feb 29 14:04:38 PST 2008
Bugs item #1874290, was opened at 2008-01-18 02:12
Message generated for change (Comment added) made by dianders
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1874290&group_id=9863
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: wxMac specific
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Douglas Anderson (dianders)
Assigned to: Stefan Csomor (csomor)
Summary: Debugging code with a menu bar crashes program...
Initial Comment:
This one has been bugging me for a while, and I finally put my finger on it! Sometimes, while debugging with Komodo, my program will just "randomly" crash. I always attributed it to a Komodo bug, but I finally found that it's a wx bug. ...at least in this one instance.
The problem stems from the fact that Komodo evaluates all of the attributes of any local variable when you're stepping through code. This is normally OK. However, stepping through all of the attributes of a wx.MenuBar causes the program to crash with a bus error!
I know you probably don't care about Komodo, but this is a major enough problem and is easy to reproduce even without Komodo. Just do this:
---
import wx
def main():
app = wx.PySimpleApp()
f = wx.Frame(None, -1, "DisableMenuTest")
menuBar = wx.MenuBar()
print "I want to crash"
print menuBar.BestSize
if __name__ == '__main__':
main()
---
There are several attributes that will cause a similar crash, including 'BestVirtualSize' and 'CharHeight'. I found them by doing this, which is probably just like what Komodo does:
for s in dir(menuBar):
print getattr(menuBar, s)
---
This problem _doesn't_ manifest itself on Windows.
Thanks!
-Doug
----------------------------------------------------------------------
>Comment By: Douglas Anderson (dianders)
Date: 2008-02-29 22:04
Message:
Logged In: YES
user_id=47448
Originator: YES
Stefan,
In case it's useful to you (or anyone else who might tackle this bug),
there's a similar problem with ProgressDialog with the "ToolBar"
attribute:
app = wx.PySimpleApp()
dlg = wx.ProgressDialog("hi", "there")
print "I want to crash"
print dlg.ToolBar
-Doug
----------------------------------------------------------------------
Comment By: Douglas Anderson (dianders)
Date: 2008-01-23 01:35
Message:
Logged In: YES
user_id=47448
Originator: YES
Hi Stefan,
...your wish is my command. Here are new steps to reproduce for you
without using Komodo...
1. Open 'PyCrust.app'.
2. Type the following commands:
>>> import wx
>>> app = wx.PySimpleApp()
>>> f = wx.Frame(None, -1, "DisableMenuTest")
>>> menuBar = wx.MenuBar()
3. Open the 'locals' (click the triangle to the left of locals).
Expect: to see local variables
Actual: pycrust crashes.
Thanks,
Doug
----------------------------------------------------------------------
Comment By: Stefan Csomor (csomor)
Date: 2008-01-19 08:51
Message:
Logged In: YES
user_id=81467
Originator: NO
Hi Robin
thanks for the clarification, I already feared that, because while we kept
telling people not to use certain calls on a menubar, we cannot tell
kommodo ... although if they'd use wxwidgets for the ide, I'd be more
motivated to fix it ;-)
Thanks,
Stefan
----------------------------------------------------------------------
Comment By: Robin Dunn (robind)
Date: 2008-01-18 17:42
Message:
Logged In: YES
user_id=53955
Originator: NO
Stefan, those attributes are actually Python properties that use the
standard getter methods to get the values. Since wxMenuBar inherits from
wxWindow it is also inheriting those properties in the Python proxy
classes. So apparently you can probably duplicate this bug by calling
GetCharHeight on a menubar instance.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1874290&group_id=9863
More information about the wx-dev
mailing list