Re: [Pyobjc-dev] autorelease pool page corrupted
Brought to you by:
ronaldoussoren
From: Jake W. <del...@gm...> - 2013-10-24 13:52:20
|
Hi Ronald, Thanks for your response! You reply only arrived once, so no worries :) I've arranged a small app to reproduce this issue. Please see the source code from this link: https://github.com/jiakuan/wx-sample *New findings* While preparing the small app, I found that the issue might be related to two event binds together with a multiple-thread environment: app.Bind(wx.EVT_QUERY_END_SESSION, OnUnexpectedExit) app.Bind(wx.EVT_END_SESSION, OnUnexpectedExit) *Sample project description* Test 1: From the sample project, please run *test_wx_and_event_1.py*, you will see a taskbar icon. When you click the taskbar icon and select "Close wxPython Sample", the app quit correctly without any issues. Test 2: From the sample project, please run *test_wx_and_event_2.py*, you will also see a taskbar icon. When you click the taskbar icon and select "Close wxPython Sample", the app quit with a system dialog as the same as the one I attached in my previous post, and an error message will be printed in console like the following: objc[9303]: autorelease pool page 0x103889000 corrupted magic 0x1038a800 0x70000000 0x1039c000 0x50000000 pthread 0x7fff79c40180 If we comment two lines (line 145 and 146) in test_wx_and_event_2.py # self.Bind(wx.EVT_QUERY_END_SESSION, self.OnUnexpectedExit) # self.Bind(wx.EVT_END_SESSION, self.OnUnexpectedExit) then no such error when quitting app from the taskbar menu. The only difference between test_wx_and_event_1.py and test_wx_and_event_2.py is that the second one used a new thread to maintain an event queue. And the issue in test 2 only happened in wxPython 2.9.5.0, no such issues for wxPython 2.9.4.0. Really appreciate your help on this issue. Thanks, Jake On Thu, Oct 24, 2013 at 7:55 PM, Ronald Oussoren <ron...@ma...>wrote: > > On 22 Oct, 2013, at 15:49, Jake Wang <del...@gm...> wrote: > > > Hi, > > > > I used PyObjc in a python application for monitoring some global events: > > > > class MacOSXEventMonitor(): > > def init(self): > > log.debug("Initializing events monitor for Mac OS X...") > > > > self._observer = > NSEvent.addGlobalMonitorForEventsMatchingMask_handler_( > > NSLeftMouseDownMask > > | NSLeftMouseUpMask > > | NSRightMouseDownMask > > | NSRightMouseUpMask > > | NSMouseMovedMask > > | NSLeftMouseDraggedMask > > | NSRightMouseDraggedMask > > | NSMouseEnteredMask > > | NSMouseExitedMask > > | NSScrollWheelMask > > | NSKeyDownMask > > | NSKeyUpMask > > | NSAlphaShiftKeyMask > > | NSShiftKeyMask > > | NSControlKeyMask > > | NSAlternateKeyMask > > | NSCommandKeyMask > > | NSNumericPadKeyMask > > | NSHelpKeyMask > > | NSFunctionKeyMask > > | NSFlagsChangedMask, self.handleEvent) > > > > def handleEvent(self, event): > > # NSLog(u"%@", event) > > > > def stop(self): > > NSEvent.removeMonitor_(self._observer) > > > > It is strange that each time when I exit the application, the following > error printed in console: > > > > objc[8775]: autorelease pool page 0x1009e0000 corrupted > > magic 0x1009ff00 0xc0000000 0x00000000 0x60000000 > > pthread 0x7fff7e917180 > > > > Also a system dialog shown (please see the screenshot attached). > > > > Anyone encountered this before? Much appreciate for any suggestions/help. > > (I'm sorry if this arrives twice, I just noticed that an earlier attempt > at replying seems to be dropped to the floor by mail.app...) > > Do you have a self-contained program that demonstrates the problem? I can > get callbacks to handleEvent by embedding the code above > in a small app, but the app doesn't crash in the way you mention. > > Ronald > > > > > Thanks, > > Jake > > > > > ------------------------------------------------------------------------------ > > October Webinars: Code for Performance > > Free Intel webinars can help you accelerate application performance. > > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most > from > > the latest Intel processors and coprocessors. See abstracts and register > > > > > http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk_______________________________________________ > > Pyobjc-dev mailing list > > Pyo...@li... > > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev > > |