News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

[mingw] Confused with wxThread and exception throwing

Started by Denis, October 07, 2007, 06:34:34 PM

Previous topic - Next topic

Denis

I have a problem when throwing exceptions at wxThread::Entry function. For example simple 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

Denis

Forgot: the problem is only in release configuration.