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;