fix(crashes): stop destroying QThread workers while still running
Deleting SearchWorker/ListWorker/InstallWorker from the `finished` -> `deleteLater` connection aborted the app with "QThread: Destroyed while thread is still running" (SIGABRT) whenever a list loaded or a package op finished. The deferred delete raced the thread teardown because these workers have no event loop to process it after run() returns. Wait for the thread to complete (wait() clears the running flag, and by then run() already emitted finished) before scheduling deleteLater, and bind every cross-thread signal to the MainWindow context object so the handlers run queued on the GUI thread instead of inside the worker. Also drop the intrusive popups (removal confirmation, pacman/sudo unavailable, empty-search notice) in favour of status bar messages, and let sudo take the password via -S so no per-op polkit dialog is shown. Generated with Codebuff 🤖 Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
5 files changed
+264
-67
No files matched your search
@@ -76,6 +76,20 @@ static void testParseSyncRepos_emptyInput() {
|
||||
assert(PacmanManager::parseSyncRepos("").empty());
|
||||
}
|
||||
|
||||
static void testAuthFailed_detectsWrongPassword() {
|
||||
assert(PacmanManager::authFailed(
|
||||
"[sudo] password for alice: Sorry, try again.\nsudo: 1 incorrect password attempt"));
|
||||
}
|
||||
|
||||
static void testAuthFailed_detectsMissingPassword() {
|
||||
assert(PacmanManager::authFailed("sudo: a password is required"));
|
||||
}
|
||||
|
||||
static void testAuthFailed_ignoresPacmanErrors() {
|
||||
assert(!PacmanManager::authFailed("error: target not found: firefox"));
|
||||
assert(!PacmanManager::authFailed("warning: firefox is up to date"));
|
||||
}
|
||||
|
||||
int main() {
|
||||
testParseInstalledOutput_parsesSimpleLines();
|
||||
testParseInstalledOutput_keepsHyphensInNames();
|
||||
@@ -87,6 +101,10 @@ int main() {
|
||||
testParseSyncRepos_skipsHeader();
|
||||
testParseSyncRepos_emptyInput();
|
||||
|
||||
testAuthFailed_detectsWrongPassword();
|
||||
testAuthFailed_detectsMissingPassword();
|
||||
testAuthFailed_ignoresPacmanErrors();
|
||||
|
||||
std::cout << "All pacman-manager tests passed." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user