From ec458a880adfb495fb7613f0faa82131192bade4 Mon Sep 17 00:00:00 2001 From: "royqh1979@gmail.com" Date: Thu, 7 Oct 2021 00:48:05 +0800 Subject: [PATCH] - fix: editor's inproject property not correctly setted (and may cause devcpp to crash when close project) --- NEWS.md | 1 + RedPandaIDE/editor.cpp | 1 + RedPandaIDE/main.cpp | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 47138668..fd30a1c5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -25,6 +25,7 @@ Version 0.6.0 - fix: editors disappeared when close/close all - implement: config shortcuts - implement: handle windows logout message + - fix: editor's inproject property not correctly setted (and may cause devcpp to crash when close project) Version 0.5.0 - enhancement: support C++ using type alias; diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 7523f014..fb24ad56 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -2794,6 +2794,7 @@ void Editor::setInProject(bool newInProject) { if (mInProject == newInProject) return; + mInProject = newInProject; if (mInProject) { initParser(); } else { diff --git a/RedPandaIDE/main.cpp b/RedPandaIDE/main.cpp index 3ad4d600..1e56d41b 100644 --- a/RedPandaIDE/main.cpp +++ b/RedPandaIDE/main.cpp @@ -29,12 +29,15 @@ public: bool WindowLogoutEventFilter::nativeEventFilter(const QByteArray &eventType, void *message, long *result){ MSG * pMsg = static_cast(message); if (pMsg->message == WM_QUERYENDSESSION) { + if (pMsg->lParam == 0 + || (pMsg->lParam & ENDSESSION_LOGOFF)) { if (!pMainWindow->close()) { *result = 0; } else { *result = 1; } - return true; + return true; + } } return false; }