Author Topic: [mingw] Confused with wxThread and exception throwing  (Read 3977 times)

Offline Denis

  • Multiple posting newcomer
  • *
  • Posts: 48
[mingw] Confused with wxThread and exception throwing
« on: October 07, 2007, 06:34:34 pm »
I have a problem when throwing exceptions at wxThread::Entry function. For example simple code
Code
class Exception {};

class WorkThread : public wxThread
{
private:
virtual void* Entry()
{
for (int i = 0; i < 100000; i++)
{
try
{
throw Exception();
}
catch (...)
{
}
}

return NULL;
}
virtual void OnExit() {}

public:
WorkThread() { }
};

wxThread* work_thread = new WorkThread();
work_thread->Create();
work_thread->Run();
causes AV, invalid instuction error or application closing.

How to solve this problem?

PS: wxWidgets is linked as static library (looks like otherwise it is no problem with this code). WinXP SP2, CoreDuo, MinGW 3.4.5 or 4.1.2
« Last Edit: October 07, 2007, 09:14:25 pm by Denis »

Offline Denis

  • Multiple posting newcomer
  • *
  • Posts: 48
Re: [mingw] Confused with wxThread and exception throwing
« Reply #1 on: October 07, 2007, 09:10:22 pm »
Forgot: the problem is only in release configuration.