From fc4449b212bc513708fefd0acf3fb57772d9f4b3 Mon Sep 17 00:00:00 2001 From: jules Date: Thu, 18 Oct 2018 12:41:03 +0100 Subject: [PATCH] Avoided a dangling pointer in the projucer --- extras/Projucer/Source/Application/jucer_MainWindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/Projucer/Source/Application/jucer_MainWindow.cpp b/extras/Projucer/Source/Application/jucer_MainWindow.cpp index faaf6409ab..77fcd794cf 100644 --- a/extras/Projucer/Source/Application/jucer_MainWindow.cpp +++ b/extras/Projucer/Source/Application/jucer_MainWindow.cpp @@ -688,7 +688,7 @@ bool MainWindowList::openFile (const File& file, bool openInBackground) if (file.hasFileExtension (Project::projectFileExtension)) { - auto previousFrontWindow = getFrontmostWindow(); + WeakReference previousFrontWindow (getFrontmostWindow()); auto* w = getOrCreateEmptyWindow(); bool ok = w->openFile (file); @@ -703,7 +703,7 @@ bool MainWindowList::openFile (const File& file, bool openInBackground) closeWindow (w); } - if (openInBackground && (previousFrontWindow != nullptr)) + if (openInBackground && previousFrontWindow != nullptr) previousFrontWindow->toFront (true); return ok;