Mac - Memory Error with TextBoxes
Stefan Csomor
csomor at advancedconcepts.ch
Sun Mar 2 12:17:06 PST 2008
Hi Ken
there are many options to do these things, it all depends on how many
changes you have and how often things change, options range from posting
events from the thread to the GUI handler (::wxPostEvent,
wxEvtHandler::AddPendingEvent) to using periodic timers on the main thread.
It is important that you guard any areas that are accessed from different
threads properly
Best,
Stefan
On 3/2/08 7:21 PM, "Kenneth Bongort" <kjb79 at cornell.edu> wrote:
> Ok, thanks! Do you have any suggestions as to how I might update my
> TextBoxes at timed intervals, without updating them directly from a
> separate thread?
>
> - Ken
>
> On Mar 2, 2008, at 6:04 AM, Stefan Csomor wrote:
>
>> Hi
>>
>> you cannot directly update a gui object on OS X form a secondary
>> thread
>> without expecting problems down the road... I've only expanded the
>> wxTextCtrl:: WriteText method to internally make a remote call from a
>> secondary thread, all other methods should only be called from the
>> main
>> thread.
>>
>> Best,
>>
>> Stefan
>>
>>
>> On 3/1/08 9:13 PM, "Kenneth Bongort" <kjb79 at cornell.edu> wrote:
>>
>>> Sorry it took so long in coming, but here's a pared-down script. The
>>> stack trace I get when I run it is pasted below.
>>>
>>> Thanks!
>>> Ken
>>>
>>>
>>>
>>> On Feb 26, 2008, at 4:06 PM, Robin Dunn wrote:
>>>
>>>> Kenneth Bongort wrote:
>>>>> Hello Everyone,
>>>>> I'm using wxPython to create a GUI, but I'm running into an error
>>>>> that seems to stem from updating TextBoxes. My program rapidly
>>>>> updates several TextBoxes, and this error always occurs after some
>>>>> period of time. I suspect it's a problem in wxWidgets for the Mac.
>>>>> Does anyone know about this issue? I pasted a stack trace below.
>>>>
>>>> Can you reproduce the problem in a small runnable sample app?
>>>>
>>>> --
>>>> Robin Dunn
>>>> Software Craftsman
>>>> http://wxPython.org Java give you jitters? Relax with wxPython!
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: wx-users-unsubscribe at lists.wxwidgets.org
>>>> For additional commands, e-mail: wx-users-help at lists.wxwidgets.org
>>>>
>>>
>>> Program received signal EXC_BAD_ACCESS, Could not access memory.
>>> Reason: KERN_PROTECTION_FAILURE at address: 0x00000016
>>> 0x90041214 in THIThemeTextInfoPublic::GetTruncation ()
>>> (gdb) bt
>>> #0 0x90041214 in THIThemeTextInfoPublic::GetTruncation ()
>>> #1 0x900419c8 in TCoreTextEngine::GetTextInfoOutputParameters ()
>>> #2 0x90046fbc in TCoreTextEngine::DrawThemeTextBox ()
>>> #3 0x900467c4 in DataEngine::DrawTextBox ()
>>> #4 0x90046574 in HIThemeDrawTextBox ()
>>> #5 0x901fdc70 in HIMenuBarView::DrawTextTitle ()
>>> #6 0x900456fc in HIMenuBarView::DrawSelf ()
>>> #7 0x90044e5c in HIView::DrawCacheOrSelf ()
>>> #8 0x90044c7c in HIView::SendDraw ()
>>> #9 0x9004493c in HIView::RecursiveDrawComposited ()
>>> #10 0x90044a3c in HIView::RecursiveDrawComposited ()
>>> #11 0x90043be4 in HIView::DrawComposited ()
>>> #12 0x90043104 in WindowData::PrepareForVisibility ()
>>> #13 0x900427f0 in _ShowHideWindows ()
>>> #14 0x900426cc in ShowHide ()
>>> #15 0x90042630 in MBarDraw ()
>>> #16 0x9002df68 in ShowBar ()
>>> #17 0x9004ed68 in SetMenuBarObscured ()
>>> #18 0x9004e7a8 in HIApplication::HandleActivated ()
>>> #19 0x9004c85c in HIApplication::EventObserver ()
>>> #20 0x90020528 in _NotifyEventLoopObservers ()
>>> #21 0x9004c478 in AcquireEventFromQueue ()
>>> #22 0x9004a160 in ReceiveNextEventCommon ()
>>> #23 0x018c3b40 in wxApp::MacDoOneEvent ()
>>> #24 0x018d9048 in wxEventLoop::Dispatch ()
>>> #25 0x01980e84 in wxEventLoopManual::Run ()
>>> #26 0x0195a2c8 in wxAppBase::MainLoop ()
>>> #27 0x00a61a2c in wxPyApp::MainLoop (this=0x85e750) at src/
>>> helpers.cpp:
>>> 156
>>> #28 0x00aae204 in _wrap_PyApp_MainLoop (args=0x8eba10) at src/mac/
>>> _core_wrap.cpp:30914
>>> #29 0x003ed0e4 in PyObject_Call (func=0x8eba10, arg=0x8eba10, kw=0x0)
>>> at /Volumes/Data/Users/ronald/Projects/python/wrk/r251/Objects/
>>> abstract.c:1860
>>> #30 0x004925c8 in PyEval_EvalFrameEx (f=0x1720cce0,
>>> throwflag=55197296) at /Volumes/Data/Users/ronald/Projects/python/
>>> wrk/
>>> r251/Python/ceval.c:3844
>>> #31 0x00493e10 in PyEval_EvalCodeEx (co=0x955ec0, globals=0x8eba10,
>>> locals=0x90041210, args=0x34a3ddc, argcount=1, kws=0x0, kwcount=0,
>>> defs=0x0, defcount=0, closure=0x0) at /Volumes/Data/Users/ronald/
>>> Projects/python/wrk/r251/Python/ceval.c:2831
>>> #32 0x004171f8 in function_call (func=0xfd8c30, arg=0x34a3dd0,
>>> kw=0x0)
>>> at /Volumes/Data/Users/ronald/Projects/python/wrk/r251/Objects/
>>> funcobject.c:517
>>> #33 0x003ed0e4 in PyObject_Call (func=0x8eba10, arg=0x8eba10, kw=0x0)
>>> at /Volumes/Data/Users/ronald/Projects/python/wrk/r251/Objects/
>>> abstract.c:1860
>>> #34 0x003f7d6c in instancemethod_call (func=0x8eba10, arg=0x34a3dd0,
>>> kw=0x0) at /Volumes/Data/Users/ronald/Projects/python/wrk/r251/
>>> Objects/
>>> classobject.c:2497
>>> #35 0x003ed0e4 in PyObject_Call (func=0x8eba10, arg=0x8eba10, kw=0x0)
>>> at /Volumes/Data/Users/ronald/Projects/python/wrk/r251/Objects/
>>> abstract.c:1860
>>> #36 0x00491f94 in PyEval_EvalFrameEx (f=0x1720ca60,
>>> throwflag=55197136) at /Volumes/Data/Users/ronald/Projects/python/
>>> wrk/
>>> r251/Python/ceval.c:3775
>>> #37 0x00491e74 in PyEval_EvalFrameEx (f=0x80af40,
>>> throwflag=388024928)
>>> at /Volumes/Data/Users/ronald/Projects/python/wrk/r251/Python/
>>> ceval.c:
>>> 3650
>>> #38 0x00493e10 in PyEval_EvalCodeEx (co=0xa0770, globals=0x8eba10,
>>> locals=0x90041210, args=0x0, argcount=0, kws=0x0, kwcount=0,
>>> defs=0x0,
>>> defcount=0, closure=0x0) at /Volumes/Data/Users/ronald/Projects/
>>> python/
>>> wrk/r251/Python/ceval.c:2831
>>> #39 0x00493fb0 in PyEval_EvalCode (co=0x8eba10, globals=0x8eba10,
>>> locals=0x0) at /Volumes/Data/Users/ronald/Projects/python/wrk/r251/
>>> Python/ceval.c:494
>>> #40 0x004b9cbc in PyRun_FileExFlags (fp=0xa01d1dac,
>>> filename=0xbffff751 "logui/ErrorDemo.py", start=657264,
>>> globals=0x6dd20, locals=0x6dd20, closeit=1, flags=0xbffff488) at /
>>> Volumes/Data/Users/ronald/Projects/python/wrk/r251/Python/
>>> pythonrun.c:
>>> 1271
>>> #41 0x004b9f00 in PyRun_SimpleFileExFlags (fp=0xa01d1dac,
>>> filename=0xbffff751 "logui/ErrorDemo.py", closeit=1,
>>> flags=0xbffff488)
>>> at /Volumes/Data/Users/ronald/Projects/python/wrk/r251/Python/
>>> pythonrun.c:877
>>> #42 0x004c98bc in Py_Main (argc=2, argv=0xbffff61c) at /Volumes/Data/
>>> Users/ronald/Projects/python/wrk/r251/Modules/main.c:523
>>> #43 0x000019bc in ?? ()
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: wx-users-unsubscribe at lists.wxwidgets.org
>>> For additional commands, e-mail: wx-users-help at lists.wxwidgets.org
>>
>> --
>>
>> Advanced Concepts AG
>> Software-Engineering
>> Heldweg 10
>> CH-8475 Ossingen
>> Switzerland
>>
>> phone:+41 52 245 0 245
>> fax:+41 52 245 0 246
>> http://www.advanced.ch
>> mailto:csomor at advanced.ch
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: wx-users-unsubscribe at lists.wxwidgets.org
>> For additional commands, e-mail: wx-users-help at lists.wxwidgets.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wx-users-help at lists.wxwidgets.org
>
--
Advanced Concepts AG
Software-Engineering
Heldweg 10
CH-8475 Ossingen
Switzerland
phone:+41 52 245 0 245
fax:+41 52 245 0 246
http://www.advanced.ch
mailto:csomor at advanced.ch
More information about the wx-users
mailing list