diff --git a/gpt4all-chat/src/chatmodel.h b/gpt4all-chat/src/chatmodel.h index a340b0ca..27e6063a 100644 --- a/gpt4all-chat/src/chatmodel.h +++ b/gpt4all-chat/src/chatmodel.h @@ -204,7 +204,8 @@ public: : QObject(nullptr) { moveToThread(parent->thread()); - setParent(parent); + // setParent must be called from the thread the object lives in + QMetaObject::invokeMethod(this, [this, parent]() { this->setParent(parent); }); } // NOTE: System messages are currently never serialized and only *stored* by the local server.