i was wondering if anyone had run into this problem.
im performing a long running task and showing the progress in my own progress dialog box (not the one in wxpython). the developer can either fork the task or perform it on the main thread. if the task is performed in the main thread then what actually happens is that the task gets performed in a separate thread (TaskRunner) but the method called by the developer to open and perform the task waits around until the TaskRunner thread is dead (not isAlive). in that loop i follow the recommendations on the wiki for longrunningtasks and do a yield.
ok, the weird problem happens in the TaskRunner. The task runner is a normal thread whose run method simply calls the task's execute method. it catches any exceptions and saves them (to show as errors later) then does a wxPostEvent(parent, TaskEnded) to notify the dialog that the task has ended and to EndModal itself. at one point i use the progress dialog to perform a long running task during shutdown (shutting down some hardware, saving, etc.). when i hit the close button on my main frame the close event is vetoed, then i open up the progress dialog and perform the tasks necessary. the weird this is this: at the end of the runner task, when wxPosteEvent(parent, TaskEvent) is called the call blocks, so the runner thread stays alive. the event is posted, however, because the dialog who responds to this event does close. if i move my mouse over a certain part of a window or i move to another app the postevent exists and the runner thread ends, finally ending the app. this does not occur regularly. i can't really tell how this is brought about. i've made sure that the parent to whom the postevent is called is still alive and that things are *only* called thru the mainthread.
has anybody run into this? my system is 2.5.2.1, fedora core 2, gtk2
i was wondering if anyone had run into this problem.
im performing a long running task and showing the progress in my own progress dialog box (not the one in wxpython). the developer can either fork the task or perform it on the main thread. if the task is performed in the main thread then what actually happens is that the task gets performed in a separate thread (TaskRunner) but the method called by the developer to open and perform the task waits around until the TaskRunner thread is dead (not isAlive). in that loop i follow the recommendations on the wiki for longrunningtasks and do a yield.
ok, the weird problem happens in the TaskRunner. The task runner is a normal thread whose run method simply calls the task's execute method. it catches any exceptions and saves them (to show as errors later) then does a wxPostEvent(parent, TaskEnded) to notify the dialog that the task has ended and to EndModal itself. at one point i use the progress dialog to perform a long running task during shutdown (shutting down some hardware, saving, etc.). when i hit the close button on my main frame the close event is vetoed, then i open up the progress dialog and perform the tasks necessary. the weird this is this: at the end of the runner task, when wxPosteEvent(parent, TaskEvent) is called the call blocks, so the runner thread stays alive. the event is posted, however, because the dialog who responds to this event does close.
Sorry, but I've read that three times and I still get lost trying to understand it. Can you reproduce the problem in a small sample app that does nothing else, and elaborates in the comments what you are doing and why?
if i move my mouse over a certain part of a window or i move to another app the postevent exists and the runner thread ends, finally ending the app.
Posted events are processed in idle time, and generating mouse events causes the event queue to become empty again so more idle events are sent. So it sounds like yout may be doing something in your posted event handler that requires some more idle time to complete but it isn't getting it for some reason. Try adding a timer (even if it does nothing) to ensure there are idle events periodically. Or you can do this after you call wx.PostEvent:
wx.CallAfter(wx.WakeUpIdle)
this does not occur regularly. i can't really tell how this is brought about. i've made sure that the parent to whom the postevent is called is still alive and that things are *only* called thru the mainthread.
has anybody run into this? my system is 2.5.2.1, fedora core 2, gtk2
Please try 2.5.2.8
ยทยทยท
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!