[Audacity-quality] Bug 1221 and Show vs ShowModal
A free multi-track audio editor and recorder
Brought to you by:
aosiniao
From: James C. <cr...@in...> - 2015-10-09 08:16:36
|
Hi Leland, > (In reply to James Crook fromcomment #2 <http://bugzilla.audacityteam.org/show_bug.cgi?id=1221#c2>) > > (In reply to Leland Lucius fromcomment #1 <http://bugzilla.audacityteam.org/show_bug.cgi?id=1221#c1>) > > Neat idea, but I think it misses the real issue. > > Isn't the real > problem that d is an on-stack variable, and so doing d.Show() > is a > disaster? Using Show() assumes d continues to exist after we exit from > > OnApplyToProject(). We either must do d.ShowModal(), or we need > > > pD = new wxDialog( ..... ); > > And leave windows to tidy up and > deallocate when the dialog exits. > Same problem in OnApplyToFiles(). > > Tried it...no difference. We actually do the wxDialog thing on the stack in several places. Probably should "standardize" on way or the other though. I looked for that and only found ShowModals on the stack, which is safe as the dialog goes away before the function exits. Can you point me at some other Show() that is done on stack? > If you take a peek at wxWidgets-3.0.2/src/msw/dialog.cpp, the Show() and Hide() methods are used as part of the ShowModal() processing. I have a feeling that by using Hide() ourselves, we "broke" the normal modal processing. > > And if you take a peek at wxWidgets-3.0.2/src/gtk/dialog.cpp, you'll see that the Show() method actually calls EndModal() if it's called to Hide() the dialog. Then our routine proceeds to call EndModal() again. > > I didn't put in the workaround lightly. |