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

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Rudra
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 216
Joined: Fri Sep 13, 2013 2:59 pm

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

Post by Rudra » Thu Sep 05, 2019 2:29 pm

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.

User avatar
doublemax
Moderator
Moderator
Posts: 13985
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

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

Post by doublemax » Thu Sep 05, 2019 2:44 pm

Is the thread usage relevant to the problem? What happens if you just start the external immediately or from a button event handler?
Use the source, Luke!

Post Reply