Hi,
I have a wxDialog and a Thread (which is not a wxThread). The Thread is updating wxTextCtrl's in my dialog. I get a deadlock, when I close the dialog. I catch the wxCloseEvent when closing, I stop the thread and call Destroy(). But when i close the dialog , during the thread is updating, I get a deadlock.
The Thread is calling the MFC method GetWindowTextLength an this is not coming back. I close the dialog by pressing the (X) on the right top.
Is there a earlier time to catch a EVT_CLOSE()?
I'm looking to read from you.
Thx, Volkan
Deadlock in GetWindowTextLength, wxDialog with a Thread
-
- Knows some wx things
- Posts: 43
- Joined: Tue Jun 13, 2006 7:21 am
- Location: Denmark
- Contact:
Uh, maybe the problem is that when you destroy a thread under Windows, it will die immedieately? That could explain why the thread does not return.
If this is the case, then you can solve it by using a mutex/critical section to prevent the destruction of the thread while it is updating:
- enter section when thread is working, exit when done.
- Enter section when destroying thread, exit when done.
(It should be possible to do this with wxThread as well)
If this is the case, then you can solve it by using a mutex/critical section to prevent the destruction of the thread while it is updating:
- enter section when thread is working, exit when done.
- Enter section when destroying thread, exit when done.
(It should be possible to do this with wxThread as well)