mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-09-24 04:59:14 -07:00
net-analyzer/wireshark: properly return from main()
Closes: https://bugs.gentoo.org/954756 Signed-off-by: Holger Hoffstätte <holger@applied-asynchrony.com> Part-of: https://github.com/gentoo/gentoo/pull/41773 Closes: https://github.com/gentoo/gentoo/pull/41773 Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
committed by
Sam James
parent
c57e411634
commit
2fdb70bfff
59
net-analyzer/wireshark/files/4.4.6-return-from-main.patch
Normal file
59
net-analyzer/wireshark/files/4.4.6-return-from-main.patch
Normal file
@@ -0,0 +1,59 @@
|
||||
Patch from: https://gitlab.com/wireshark/wireshark/-/commit/b4d6d76c6eba2da7f8df55c328607fe651037c03
|
||||
Removed hunk #2 which was for Stratoshark.
|
||||
|
||||
From b4d6d76c6eba2da7f8df55c328607fe651037c03 Mon Sep 17 00:00:00 2001
|
||||
From: John Thacker <johnthacker@gmail.com>
|
||||
Date: Sat, 22 Feb 2025 10:19:36 -0500
|
||||
Subject: [PATCH] Qt: Return from main instead of calling exit_application
|
||||
|
||||
If the main event loop isn't running (and it can't be if we reach the
|
||||
clean_exit label in main()), then exit_application just calls stdlib
|
||||
exit. Returning from main does the same thing, execept the QApplication
|
||||
(function scoped) will be destroyed first. That's better for dealing
|
||||
with KDE Breeze mixing thread_local and QThreadStorage and having
|
||||
deleteLater. It ensures that objects get deleted before all the
|
||||
thread_local storage is destroyed.
|
||||
|
||||
I can't replicate #14395 after this change, including by putting in
|
||||
the extra goto clean_exit mentioned in that issue's comments, on
|
||||
Qt 5.15, Qt 6, and different OSes.
|
||||
|
||||
Fix #20370
|
||||
---
|
||||
ui/qt/main.cpp | 14 +++++++++++++-
|
||||
ui/stratoshark/stratoshark_main.cpp | 2 +-
|
||||
2 files changed, 14 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/ui/qt/main.cpp b/ui/qt/main.cpp
|
||||
index e73496d4017..6d22ca43cc9 100644
|
||||
--- a/ui/qt/main.cpp
|
||||
+++ b/ui/qt/main.cpp
|
||||
@@ -117,9 +117,21 @@ void main_window_update(void)
|
||||
}
|
||||
|
||||
void exit_application(int status) {
|
||||
+ // It's generally better to return from main. If the event loop is
|
||||
+ // running (or has already stopped), wsApp->quit will cause the app
|
||||
+ // to do so. (So we wouldn't need to call stdlib exit.) If it's not
|
||||
+ // yet running, e.g., failure parsing options in ui/commandline.c,
|
||||
+ // it's would be cleaner to return back to main and exit from there,
|
||||
+ // especially if wsApp has been created.
|
||||
if (wsApp) {
|
||||
+ // wsApp->quit() is a no-op if the event loop isn't running
|
||||
+ // (That was not true in some earlier versions of Qt.)
|
||||
+ // wsApp->exit(status) is not thread safe, though it may be possible to call
|
||||
+ //QMetaObject::invokeMethod(wsApp, "exit", Qt::QueuedConnection, status);
|
||||
+ // or similar, e.g. with a QTimer
|
||||
wsApp->quit();
|
||||
}
|
||||
+ // Calling stdlib exit here does not call the wsApp destructor.
|
||||
exit(status);
|
||||
}
|
||||
|
||||
@@ -1128,5 +1140,5 @@ clean_exit:
|
||||
wtap_cleanup();
|
||||
free_progdirs();
|
||||
commandline_options_free();
|
||||
- exit_application(ret_val);
|
||||
+ return ret_val;
|
||||
}
|
||||
@@ -120,6 +120,7 @@ fi
|
||||
PATCHES=(
|
||||
"${FILESDIR}/4.4.4-fix-skipping-rawshark-tests-on-big-endian.patch"
|
||||
"${FILESDIR}/4.4.6-lto.patch"
|
||||
"${FILESDIR}/4.4.6-return-from-main.patch"
|
||||
)
|
||||
|
||||
python_check_deps() {
|
||||
Reference in New Issue
Block a user