Page 1 of 1

[wxMSW][wx3.0.3] wxExecute with wxEXEC_ASYNC in wxThreadEventHandler triggers wxApp::OnExit()

Posted: Thu Sep 05, 2019 2:29 pm
by Rudra
Hi

I my wx application, I have a join able thread. From wxThread::Entry() function, I am posting an event as follows,

Code: Select all

wxThreadEvent* evt = new wxThreadEvent();
evt->SetId(kMerge);
wxQueueEvent(wxTheApp, evt);
When wxThreadEventHandler is triggered, I am launching an exe (ffmpeg app) using wxExecute with wxEXEC_ASYNC flag. The ffmpeg app launches fine and it does the work but as soon as ffmpeg app closes wxApp::OnExit() gets triggered. I am unable to figure it out how and why.

If I use wxEXEC_SYNC then all goes okay. wxApp::OnExit() is not triggered when ffmpeg gets closed.

wxExecute won't work in Thread, that is why I am posting event so it can be called from main thread.

How I can prevent wxApp::OnExit() if I am using wxEXEC_ASYNC flag. Please suggest.

Thanks
R.

Re: [wxMSW][wx3.0.3] wxExecute with wxEXEC_ASYNC in wxThreadEventHandler triggers wxApp::OnExit()

Posted: Thu Sep 05, 2019 2:44 pm
by doublemax
Is the thread usage relevant to the problem? What happens if you just start the external immediately or from a button event handler?