From 416852c0cd216a772558f4079efaba9dfd8b2142 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Fri, 23 Jun 2017 10:19:16 -0700 Subject: [PATCH] Fix warnings about creating QObjects with parents in different thread --- interface/src/Application.cpp | 6 +++++- libraries/gpu-gl/src/gpu/gl/GLBackend.cpp | 5 +++++ libraries/gpu-gl/src/gpu/gl/GLTexture.cpp | 5 ----- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index a7bed9fc9c..1ce21f9ec7 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -713,9 +713,13 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo updateHeartbeat(); // setup a timer for domain-server check ins - QTimer* domainCheckInTimer = new QTimer(nodeList.data()); + QTimer* domainCheckInTimer = new QTimer(this); connect(domainCheckInTimer, &QTimer::timeout, nodeList.data(), &NodeList::sendDomainServerCheckIn); domainCheckInTimer->start(DOMAIN_SERVER_CHECK_IN_MSECS); + connect(this, &QCoreApplication::aboutToQuit, [domainCheckInTimer] { + domainCheckInTimer->stop(); + domainCheckInTimer->deleteLater(); + }); auto audioIO = DependencyManager::get(); diff --git a/libraries/gpu-gl/src/gpu/gl/GLBackend.cpp b/libraries/gpu-gl/src/gpu/gl/GLBackend.cpp index 791130ef6e..3441407f62 100644 --- a/libraries/gpu-gl/src/gpu/gl/GLBackend.cpp +++ b/libraries/gpu-gl/src/gpu/gl/GLBackend.cpp @@ -178,6 +178,11 @@ void GLBackend::init() { int swapInterval = wglGetSwapIntervalEXT(); qCDebug(gpugllogging, "V-Sync is %s\n", (swapInterval > 0 ? "ON" : "OFF")); }*/ +#endif +#if THREADED_TEXTURE_BUFFERING + // This has to happen on the main thread in order to give the thread + // pool a reasonable parent object + GLVariableAllocationSupport::TransferJob::startBufferingThread(); #endif }); } diff --git a/libraries/gpu-gl/src/gpu/gl/GLTexture.cpp b/libraries/gpu-gl/src/gpu/gl/GLTexture.cpp index 4161242a24..7758ddaf49 100644 --- a/libraries/gpu-gl/src/gpu/gl/GLTexture.cpp +++ b/libraries/gpu-gl/src/gpu/gl/GLTexture.cpp @@ -461,11 +461,6 @@ void GLVariableAllocationSupport::updateMemoryPressure() { if (newState != _memoryPressureState) { _memoryPressureState = newState; -#if THREADED_TEXTURE_BUFFERING - if (MemoryPressureState::Transfer == _memoryPressureState) { - TransferJob::startBufferingThread(); - } -#endif // Clear the existing queue _transferQueue = WorkQueue(); _promoteQueue = WorkQueue();