diff --git a/src/Project.cpp b/src/Project.cpp index 06d23eaa0..eb22c63d9 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -737,6 +737,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id, mMixerBoardFrame(NULL), mFreqWindow(NULL), mToolManager(NULL), + mbBusyImporting(false), mAudioIOToken(-1), mIsDeleting(false), mTracksFitVerticallyZoomed(false), //lda @@ -1819,16 +1820,17 @@ void AudacityProject::OnMouseEvent(wxMouseEvent & event) // and/or attempts to delete objects twice. void AudacityProject::OnCloseWindow(wxCloseEvent & event) { + if (event.CanVeto() && (::wxIsBusy() || mbBusyImporting)) + { + event.Veto(); + return; + } + if (mFreqWindow) { mFreqWindow->Destroy(); mFreqWindow = NULL; } - if (wxIsBusy()) { - event.Veto(); - return; - } - // Check to see if we were playing or recording // audio, and if so, make sure Audio I/O is completely finished. // The main point of this is to properly push the state diff --git a/src/Project.h b/src/Project.h index 9cc6dbe2c..eb84f3400 100644 --- a/src/Project.h +++ b/src/Project.h @@ -492,6 +492,7 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame, bool mShowSplashScreen; wxString mHelpPref; wxString mSoloPref; + bool mbBusyImporting; // used to fix bug 584 void SetNormalizedWindowState(wxRect pSizeAndLocation) { mNormalizedWindowState = pSizeAndLocation; } wxRect GetNormalizedWindowState() const { return mNormalizedWindowState; } diff --git a/src/import/Import.cpp b/src/import/Import.cpp index ec65354a0..c64a5521b 100644 --- a/src/import/Import.cpp +++ b/src/import/Import.cpp @@ -327,6 +327,9 @@ int Importer::Import(wxString fName, Tags *tags, wxString &errorMessage) { + AudacityProject *pProj = GetActiveProject(); + pProj->mbBusyImporting = true; + ImportFileHandle *inFile = NULL; int numTracks = 0; @@ -670,6 +673,8 @@ int Importer::Import(wxString fName, errorMessage.Printf(_("Audacity recognized the type of the file '%s'.\nImporters supposedly supporting such files are:\n%s,\nbut none of them understood this file format."),fName.c_str(), pluglist.c_str()); } + pProj->mbBusyImporting = false; + return 0; }