From a4ef9bbad1702857dc703ff4196052ba6ea0c8c1 Mon Sep 17 00:00:00 2001 From: andreja6 Date: Wed, 6 Nov 2019 10:49:16 -0800 Subject: [PATCH] Maybe rush condition? --- Application.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Application.cpp b/Application.cpp index eff3fbe..372d7c8 100644 --- a/Application.cpp +++ b/Application.cpp @@ -56,15 +56,16 @@ PartInstance* Application::makePart() void Application::setFocus(bool focus) { - if(focus) - { - ShowWindow(_propWindow->_hwndProp, SW_SHOW); - SetWindowPos(_propWindow->_hwndProp, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); - } - else - { - SetWindowPos(_propWindow->_hwndProp, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); - } + if(_propWindow->_hwndProp != NULL) + if(focus) + { + ShowWindow(_propWindow->_hwndProp, SW_SHOW); + SetWindowPos(_propWindow->_hwndProp, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + } + else + { + SetWindowPos(_propWindow->_hwndProp, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + } } Application::Application(HWND parentWindow) { //: GApp(settings,window) {