From 18dbfddcb3a7e2797f4cdb35b67801545c3d1531 Mon Sep 17 00:00:00 2001 From: Adam Treat Date: Tue, 11 Jul 2023 13:07:15 -0400 Subject: [PATCH] Fix default thread setting. --- gpt4all-chat/mysettings.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gpt4all-chat/mysettings.cpp b/gpt4all-chat/mysettings.cpp index 71b2334d..4ddcf815 100644 --- a/gpt4all-chat/mysettings.cpp +++ b/gpt4all-chat/mysettings.cpp @@ -350,6 +350,10 @@ int MySettings::threadCount() const QSettings setting; setting.sync(); int c = setting.value("threadCount", default_threadCount).toInt(); + // The old thread setting likely left many people with 0 in settings config file, which means + // we should reset it to the default going forward + if (c <= 0) + c = default_threadCount; c = std::max(c, 1); c = std::min(c, QThread::idealThreadCount()); return c;