diff --git a/src/Project.cpp b/src/Project.cpp index e02f90bf2..a3d5a7472 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -1983,8 +1983,13 @@ void AudacityProject::OnCloseWindow(wxCloseEvent & event) // Destroy the TrackPanel early so it's not around once we start // deleting things like tracks and such out from underneath it. - mTrackPanel->Destroy(); - mTrackPanel = NULL; // Make sure this gets set...see HandleResize() + // Check validity of mTrackPanel per bug 584 Comment 1. + // Deeper fix is in the Import code, but this failsafes against crash. + if (mTrackPanel) + { + mTrackPanel->Destroy(); + mTrackPanel = NULL; // Make sure this gets set...see HandleResize() + } // Delete the tool manager before the children since it needs // to save the state of the toolbars. diff --git a/src/import/ImportPlugin.h b/src/import/ImportPlugin.h index fba698f2c..c9c3628ab 100644 --- a/src/import/ImportPlugin.h +++ b/src/import/ImportPlugin.h @@ -128,6 +128,7 @@ public: if (mProgress != NULL) { delete mProgress; + mProgress = NULL; } }