From 0245bd5c3ad210e3da1df875188e9dcbd0e78a1b Mon Sep 17 00:00:00 2001 From: ch-ems Date: Mon, 25 Jun 2018 15:41:18 +0100 Subject: [PATCH] fixed crash when enabling 'window always on top' --- src/widgets/basewindow.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/widgets/basewindow.cpp b/src/widgets/basewindow.cpp index 18ef0e2a..d6b32b9f 100644 --- a/src/widgets/basewindow.cpp +++ b/src/widgets/basewindow.cpp @@ -167,10 +167,12 @@ void BaseWindow::init() // fourtf: don't ask me why we need to delay this if (!(this->flags_ & Flags::TopMost)) { QTimer::singleShot(1, this, [this] { - getApp()->settings->windowTopMost.connect([this](bool topMost, auto) { - ::SetWindowPos(HWND(this->winId()), topMost ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, - 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); - }); + this->connections_.managedConnect( + getApp()->settings->windowTopMost.getValueChangedSignal(), + [this](bool topMost, auto) { + ::SetWindowPos(HWND(this->winId()), topMost ? HWND_TOPMOST : HWND_NOTOPMOST, 0, + 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + }); }); } #else @@ -178,7 +180,7 @@ void BaseWindow::init() // this->setWindowFlag(Qt::WindowStaysOnTopHint); // } #endif -} +} // namespace widgets void BaseWindow::setStayInScreenRect(bool value) {