From 0e508432c4c745d08d890502d7279c062fc7b105 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Fri, 4 Aug 2017 15:27:33 -0700 Subject: [PATCH] PR comments --- libraries/shared/src/ThreadHelpers.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libraries/shared/src/ThreadHelpers.cpp b/libraries/shared/src/ThreadHelpers.cpp index 8cf8b85284..654b8e0252 100644 --- a/libraries/shared/src/ThreadHelpers.cpp +++ b/libraries/shared/src/ThreadHelpers.cpp @@ -38,11 +38,14 @@ void setThreadName(const std::string& name) { void moveToNewNamedThread(QObject* object, const QString& name, std::function preStartCallback, std::function startCallback, QThread::Priority priority) { Q_ASSERT(QThread::currentThread() == object->thread()); - // setup a thread for the NodeList and its PacketReceiver + + // Create the target thread QThread* thread = new QThread(); thread->setObjectName(name); - // Execute any additional work to do before the thread starts (like moving members to the target thread + // Execute any additional work to do before the thread starts like moving members to the target thread. + // This is required as QObject::moveToThread isn't virutal, so we can't override it on objects that contain + // an OpenGLContext and ensure that the context moves to the target thread as well. preStartCallback(thread); // Link the in-thread initialization code @@ -54,8 +57,10 @@ void moveToNewNamedThread(QObject* object, const QString& name, std::function