aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2017-11-17 15:13:48 -0800
committerAnders Broman <a.broman58@gmail.com>2017-11-18 07:32:10 +0000
commitc2b9c90367e2182bc7eea4832e5a235c97b18133 (patch)
treea6266ad36207bb34e6e0b49e23a792b8d14a4197
parenta398a9573d36285fc4c6c8ddf5e8d42a150e0fc8 (diff)
Qt: Use QThreadPool instead of QThread.
I'm not sure how many Qt worker threads we're going to create at startup, but using a thread pool is simple enough. Change-Id: I66c3e1e628f8c38c8e3322e0c01ee5fccda2a98e Reviewed-on: https://code.wireshark.org/review/24473 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--wireshark-qt.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/wireshark-qt.cpp b/wireshark-qt.cpp
index c1a5f27c62..73c5153ca7 100644
--- a/wireshark-qt.cpp
+++ b/wireshark-qt.cpp
@@ -97,7 +97,7 @@
#include <QMessageBox>
#include <QMimeDatabase>
-#include <QThread>
+#include <QThreadPool>
#ifdef _WIN32
# include "caputils/capture-wpcap.h"
@@ -143,7 +143,7 @@
// QMimeDatabase can be slow to initialize. Do so in a worker thread
// as early as possible.
// https://github.com/lxde/pcmanfm-qt/issues/415
-class MimeDatabaseInitThread : public QThread
+class MimeDatabaseInitThread : public QRunnable
{
private:
void run()
@@ -395,8 +395,8 @@ int main(int argc, char *qt_argv[])
QTextCodec::setCodecForTr(utf8codec);
#endif
- MimeDatabaseInitThread mime_db_init_thread;
- mime_db_init_thread.start();
+ MimeDatabaseInitThread *mime_db_init_thread = new(MimeDatabaseInitThread);
+ QThreadPool::globalInstance()->start(mime_db_init_thread);
/* Set the C-language locale to the native environment. */
setlocale(LC_ALL, "");