#13479: memory/stack corruption in multiple instances of wx.App()

5 views
Skip to first unread message

wxTrac

unread,
Sep 15, 2011, 1:57:10 AM9/15/11
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/13479>

#13479: memory/stack corruption in multiple instances of wx.App()
-------------------------+--------------------------------------------------
Reporter: schlake | Owner:
Type: defect | Status: new
Priority: normal | Milestone: 2.9.2
Component: wxOSX-Cocoa | Version: 2.9.2
Keywords: | Blockedby:
Patch: 0 | Blocking:
-------------------------+--------------------------------------------------
MacOS X 10.7.1, Python 2.7.1, wx 2.9.2.4 osx-cocoa (classic)

I've got a big program that does this:
AssertionError: No wx.App created yet
objc[2029]: autorelease pool page 0x7ffc7a831000 corrupted
magic fb11fb11 fb11fb11 fb11fb06 fb11fb11
pthread 0xfb06fb06fb060106

Illegal instruction: 4

It's kind of exciting.

I tried to make a smaller program with the same error, but I got this
instead:
wx._core.PyNoAppError: The wx.App object must be created first!
Segmentation fault: 11


The smaller program is this (close the window to manifest the bug) but is
conceptually the same as the bigger program:
import wx

while True:
app = wx.App()
frame = wx.Frame(None, -1, 'bug.py')
frame.Show()
app.MainLoop()

If I throw in an "app.Destroy()" after the MainLoop(), then the crash goes
away. But it probably shouldn't crash, and the assertions don't make any
sense with regard to what is actually happening.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/13479>

wxTrac

unread,
Sep 15, 2011, 2:22:03 AM9/15/11
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/13479#comment:1>

#13479: memory/stack corruption in multiple instances of wx.App()

----------------------+-----------------------------------------------------


Reporter: schlake | Owner:
Type: defect | Status: new
Priority: normal | Milestone: 2.9.2

Component: wxPython | Version: 2.9.2


Keywords: | Blockedby:
Patch: 0 | Blocking:

----------------------+-----------------------------------------------------
Changes (by csomor):

* component: wxOSX-Cocoa => wxPython

--
Ticket URL: <http://trac.wxwidgets.org/ticket/13479#comment:1>

wxTrac

unread,
Sep 16, 2011, 1:56:20 PM9/16/11
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/13479#comment:2>

#13479: memory/stack corruption in multiple instances of wx.App()

-----------------------+----------------------------------------------------
Reporter: schlake | Owner:
Type: defect | Status: closed
Priority: normal | Milestone: 2.9.2
Component: wxPython | Version: 2.9.2
Resolution: wontfix | Keywords:
Blockedby: | Patch: 0
Blocking: |
-----------------------+----------------------------------------------------
Changes (by robind):

* status: new => closed
* resolution: => wontfix


Comment:

It really is not a good idea to have more than one wx.App created in a
single process, there are some assumptions made in the wxWidgets code and
underlying toolkits that that in effect expect there to be ever only one
wxApp or that the platform/toolkit will only be initialized once.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/13479#comment:2>

wxTrac

unread,
Sep 16, 2011, 2:10:37 PM9/16/11
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/13479#comment:3>

#13479: memory/stack corruption in multiple instances of wx.App()

-----------------------+----------------------------------------------------
Reporter: schlake | Owner:
Type: defect | Status: reopened
Priority: normal | Milestone: 2.9.2
Component: wxPython | Version: 2.9.2
Resolution: | Keywords:
Blockedby: | Patch: 0
Blocking: |
-----------------------+----------------------------------------------------
Changes (by schlake):

* status: closed => reopened
* resolution: wontfix =>


Comment:

Well this is a stunning closure to my ticket.

Is it really good coding policy to pop and ignore bad assertions then
wander off into random data and try to execute it? I can answer that
question without much thought: it is not appropriate.

Errors should not lead to illegal instructions or segmentation faults.
Errors should be caught and propagated up.

I am reopening this simply because ignoring a memory corruption bug and
allowing it remain in the code is a negligent act.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/13479#comment:3>

wxTrac

unread,
Nov 13, 2012, 11:15:38 AM11/13/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/13479#comment:4>

#13479: memory/stack corruption in multiple instances of wx.App()
-----------------------+----------------------------------------------------
Reporter: schlake | Owner:
Type: defect | Status: reopened
Priority: low | Milestone:
Component: wxPython | Version: 2.9.2
Resolution: | Keywords:
Blockedby: | Patch: 0
Blocking: |
-----------------------+----------------------------------------------------
Changes (by vadz):

* priority: normal => low
* milestone: 2.9.2 =>



--
Ticket URL: <http://trac.wxwidgets.org/ticket/13479#comment:4>
Reply all
Reply to author
Forward
0 new messages