Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

#shaders: fix warnings about context thread

Ivan Mahonin1213cfb37b6e
diff --git a/toonz/sources/stdfx/shadingcontext.cpp b/toonz/sources/stdfx/shadingcontext.cpp
index 81f45bd79..f298e3c95 100644
--- a/toonz/sources/stdfx/shadingcontext.cpp
+++ b/toonz/sources/stdfx/shadingcontext.cpp
@@ -82,7 +82,7 @@ private:
//--------------------------------------------------------
ShadingContext::Imp::Imp()
- : m_context(new QOpenGLContext()) {}
+ : m_context(new QOpenGLContext()), m_surface() {}
//--------------------------------------------------------
@@ -131,15 +131,11 @@ ShadingContext::ShadingContext() : m_imp(new Imp) {
//--------------------------------------------------------
ShadingContext::~ShadingContext() {
-#ifdef MACOSX
// Destructor of QGLPixelBuffer calls QOpenGLContext::makeCurrent()
// internally,
// so the current thread must be the owner of QGLPixelBuffer context,
// when the destructor of m_imp->m_context is called.
-
- m_imp->m_pixelBuffer->context()->contextHandle()->moveToThread(
- QThread::currentThread());
-#endif
+ m_imp->m_context->moveToThread(QThread::currentThread());
}
//--------------------------------------------------------
@@ -187,12 +183,8 @@ USE HARDWARE ACCELERATION
//--------------------------------------------------------
void ShadingContext::makeCurrent() {
-//#ifdef MACOSX
- m_imp->m_context->moveToThread(
- QThread::currentThread());
-//#endif
- //m_imp->m_context->makeCurrent();
- m_imp->m_context.reset(new QOpenGLContext());
+ m_imp->m_context->moveToThread(QThread::currentThread());
+ m_imp->m_context.reset(new QOpenGLContext());
QSurfaceFormat format;
m_imp->m_context->setFormat(format);
m_imp->m_context->create();
@@ -202,9 +194,7 @@ void ShadingContext::makeCurrent() {
//--------------------------------------------------------
void ShadingContext::doneCurrent() {
-#ifdef MACOSX
- m_imp->m_pixelBuffer->context()->contextHandle()->moveToThread(0);
-#endif
+ m_imp->m_context->moveToThread(0);
m_imp->m_context->doneCurrent();
}