Clear QCocoaGLContext's m_currentWindow when window is hidden.
Task-number: QTBUG-35363 Change-Id: I1b3d883ed10200af8a2d4188fb1725b36eb78022 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>bb10
parent
5726999a8c
commit
ec03058fa5
|
|
@ -75,6 +75,8 @@ public:
|
|||
bool isSharing() const;
|
||||
bool isValid() const;
|
||||
|
||||
void windowWasHidden();
|
||||
|
||||
private:
|
||||
void setActiveWindow(QWindow *window);
|
||||
void updateSurfaceFormat();
|
||||
|
|
|
|||
|
|
@ -165,6 +165,16 @@ QSurfaceFormat QCocoaGLContext::format() const
|
|||
return m_format;
|
||||
}
|
||||
|
||||
void QCocoaGLContext::windowWasHidden()
|
||||
{
|
||||
// If the window is hidden, we need to unset the m_currentWindow
|
||||
// variable so that succeeding makeCurrent's will not abort prematurely
|
||||
// because of the optimization in setActiveWindow.
|
||||
// Doing a full doneCurrent here is not preferable, because the GL context
|
||||
// might be rendering in a different thread at this time.
|
||||
m_currentWindow.clear();
|
||||
}
|
||||
|
||||
void QCocoaGLContext::swapBuffers(QPlatformSurface *surface)
|
||||
{
|
||||
QWindow *window = static_cast<QCocoaWindow *>(surface)->window();
|
||||
|
|
|
|||
|
|
@ -388,6 +388,8 @@ void QCocoaWindow::setVisible(bool visible)
|
|||
[m_contentView setHidden:NO];
|
||||
} else {
|
||||
// qDebug() << "close" << this;
|
||||
if (m_glContext)
|
||||
m_glContext->windowWasHidden();
|
||||
if (m_nsWindow) {
|
||||
if (m_hasModalSession) {
|
||||
QCocoaEventDispatcher *cocoaEventDispatcher = qobject_cast<QCocoaEventDispatcher *>(QGuiApplication::instance()->eventDispatcher());
|
||||
|
|
|
|||
Loading…
Reference in New Issue