From f306e288b900dd40ed23a688cfb4bdf171d14784 Mon Sep 17 00:00:00 2001 From: nerix Date: Sun, 4 Jun 2023 14:21:16 +0200 Subject: [PATCH] Prevent Generation of Crashdumps When the Browser Is Closed (#4667) * fix: extension process generating crashdumps * fix: move `getApp` call * chore: remove distracting comments * chore: add changelog entry --- CHANGELOG.md | 1 + src/BrowserExtension.cpp | 1 + src/singletons/NativeMessaging.cpp | 6 ++---- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9387dd41e..5d3d2090a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Minor: Add an icon showing when streamer mode is enabled (#4410) - Minor: Added `/shoutout ` commands to shoutout specified user. (#4638) - Minor: Improved editing hotkeys. (#4628) +- Bugfix: Fixed generation of crashdumps by the browser-extension process when the browser was closed. (#4667) - Dev: Added command to set Qt's logging filter/rules at runtime (`/c2-set-logging-rules`). (#4637) - Dev: Added the ability to see & load custom themes from the Themes directory. No stable promises are made of this feature, changes might be made that breaks custom themes without notice. (#4570) - Dev: Added test cases for emote and tab completion. (#4644) diff --git a/src/BrowserExtension.cpp b/src/BrowserExtension.cpp index dad0ac2af..8ae25ac99 100644 --- a/src/BrowserExtension.cpp +++ b/src/BrowserExtension.cpp @@ -75,6 +75,7 @@ namespace { client.sendMessage(data); } + _Exit(0); } } // namespace diff --git a/src/singletons/NativeMessaging.cpp b/src/singletons/NativeMessaging.cpp index 620e5ee37..5e72e131f 100644 --- a/src/singletons/NativeMessaging.cpp +++ b/src/singletons/NativeMessaging.cpp @@ -189,7 +189,6 @@ void NativeMessagingServer::ReceiverThread::run() void NativeMessagingServer::ReceiverThread::handleMessage( const QJsonObject &root) { - auto app = getApp(); QString action = root.value("action").toString(); if (action.isNull()) @@ -237,6 +236,8 @@ void NativeMessagingServer::ReceiverThread::handleMessage( if (_type == "twitch") { postToThread([=] { + auto *app = getApp(); + if (!name.isEmpty()) { auto channel = app->twitch->getOrAddChannel(name); @@ -249,15 +250,12 @@ void NativeMessagingServer::ReceiverThread::handleMessage( if (attach || attachFullscreen) { #ifdef USEWINSDK - // if (args.height != -1) { auto *window = AttachedWindow::get(::GetForegroundWindow(), args); if (!name.isEmpty()) { window->setChannel(app->twitch->getOrAddChannel(name)); } -// } -// window->show(); #endif } });