Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: Block system shutdown until we are properly shutdown #9227

Merged
merged 1 commit into from
Nov 22, 2021

Conversation

TheOneRing
Copy link
Member

No description provided.

@TheOneRing
Copy link
Member Author

We now block for up to 5s, if we take longer we might get killed by the system.
https://docs.microsoft.com/en-us/windows/win32/shutdown/shutdown-changes-for-windows-vista

We could also use ShutdownBlockReasonCreate

src/gui/guiutility.cpp Outdated Show resolved Hide resolved
@@ -2,6 +2,10 @@ include(ECMAddAppIcon)

find_package(Qt5 REQUIRED COMPONENTS Widgets)

#if (WIN32)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is an optional dependency, consider introducing a CMake variable allowing users to opt into adding it. Could also be used in the code to opt into setting that icon.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't consider it optional.
Optional dependencies never solved an issue, optional Qt modules certainly never did that.

src/gui/guiutility.cpp Show resolved Hide resolved
OC_ASSERT(RegisterClass(&wc));

auto window = CreateWindowW(wc.lpszClassName, L"watcher", WS_OVERLAPPED, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, nullptr, nullptr, wc.hInstance, nullptr);
OC_ASSERT_X(window, Utility::formatWinError(GetLastError()).toUtf8().constData());
auto watcherWindow = CreateWindowW(wc.lpszClassName, reinterpret_cast<const wchar_t *>(Theme::instance()->appNameGUI().utf16()),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need the app name more than once. Might be easier to create a variable for it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Different scopes, and the lambda can't capture anything.

@sonarcloud
Copy link

sonarcloud bot commented Nov 22, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 7 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@TheOneRing TheOneRing requested review from fmoc, a team and erikjv November 22, 2021 10:50
@TheOneRing TheOneRing merged commit ade5977 into 2.9 Nov 22, 2021
@delete-merged-branch delete-merged-branch bot deleted the work/block branch November 22, 2021 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants