From 51c5c73b3b78a6baa5573d7c91ccdb8921954299 Mon Sep 17 00:00:00 2001 From: James Crook Date: Mon, 3 Jul 2017 19:47:33 +0100 Subject: [PATCH] Bug 1672 - OS window close button crashes Audacity if Screenshot Tools are open. File > Close hides Screenshot tools and then any closure method crashes Audacity. --- src/Screenshot.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Screenshot.cpp b/src/Screenshot.cpp index 0572bc3cd..67d61cce7 100644 --- a/src/Screenshot.cpp +++ b/src/Screenshot.cpp @@ -109,7 +109,13 @@ void OpenScreenshotTools() void CloseScreenshotTools() { - mFrame.reset(); + // The code below looks like a memory leak, + // but actually wxWidgets will take care of deleting the + // screenshot window, becuase the parent window is + // being deleted. So we only need to free up our pointer + // to it, not actually delete the underlying object. + if( mFrame ) + mFrame.release(); } ////////////////////////////////////////////////////////////////////////////////