Using QOpenGLContext in multiple threads, getting "CoreAnimation: warning..."
-
Hello,
I am getting the following warning when trying to create OpenGL contexts with offscreen surfaces in multiple threads on Mac OS X Yosemite (Qt 5.2.0 clang):
bq. CoreAnimation: warning, deleted thread with uncommitted CATransaction; created by:
0 QuartzCore 0x00007fff945510ea _ZN2CA11Transaction4pushEv + 312
1 QuartzCore 0x00007fff94550f8a _ZN2CA11Transaction15ensure_implicitEv + 276
2 QuartzCore 0x00007fff94550e24 _ZN2CA11Transaction9set_valueEj12_CAValueTypePKv + 40
3 QuartzCore 0x00007fff94550db8 +[CATransaction setDisableActions:] + 38
4 CoreUI 0x00007fff9acce81f -[CUIWindowFrameLayer dealloc] + 96
5 libobjc.A.dylib 0x00007fff9482f91f _ZN12_GLOBAL__N_119AutoreleasePoolPage3popEPv + 575
6 CoreFoundation 0x00007fff8cde4272 _CFAutoreleasePoolPop + 50
7 Foundation 0x00007fff8d1fa413 -[NSAutoreleasePool release] + 146
8 libqcocoa.dylib 0x0000000104e1c6b1 _ZN12QCocoaWindow14createNSWindowEv + 641
9 libqcocoa.dylib 0x0000000104e1a330 _ZN12QCocoaWindow14recreateWindowEPK15QPlatformWindow + 384
10 libqcocoa.dylib 0x0000000104e1a03e _ZN12QCocoaWindowC2EP7QWindow + 622
11 libqcocoa.dylib 0x0000000104e160f2 _ZNK17QCocoaIntegration20createPlatformWindowEP7QWindow + 34
12 QtGui 0x0000000100de3113 _ZN7QWindow6createEv + 51
13 QtCtx 0x000000010000491a _Z13anotherThreadv + 250
14 QtCtx 0x0000000100005103 _ZN12QtConcurrent18StoredFunctorCall0IvPFvvEE10runFunctorEv + 19
15 QtCtx 0x0000000100004ff7 _ZN12QtConcurrent15RunFunctionTaskIvE3runEv + 87A minimal sample code looks the following:
@#include <QtCore>
#include <QtOpenGL>
#include <QtConcurrent/qtconcurrentrun.h>QOpenGLContext* ctxMain;
void anotherThread()
{
// create context
QOpenGLContext* ctx2 = new QOpenGLContext();
ctx2->setFormat(ctxMain->format());
ctx2->setShareContext(ctxMain);
ctx2->create();// create surface QOffscreenSurface* surface2 = new QOffscreenSurface(); surface2->setFormat(ctxMain->format()); surface2->create(); // TODO do drawing here // clean up ctx2->deleteLater(); surface2->deleteLater();
}
int main(int argc, char **argv)
{
QApplication app(argc, argv);// create OpenGL context ctxMain = new QOpenGLContext(); QSurfaceFormat format; ctxMain->setFormat(format); ctxMain->create(); // create surface QOffscreenSurface* surfaceMain = new QOffscreenSurface(); surfaceMain->create(); // TODO do drawing here // run another thread QFuture<void> future = QtConcurrent::run(&anotherThread); while (!future.isFinished()) QThread::sleep(10); // clean up ctxMain->deleteLater(); surfaceMain->deleteLater(); return 0;
}@
Do you know what causes this message? Is there a way how to fix this?