- reset framebuffer pointer on destruction in Cocoa backend

Added debug validation of framebuffer pointer as well
This commit is contained in:
alexey.lysiuk 2018-06-30 11:06:41 +03:00
parent 651e735246
commit a1d5833c8a

View file

@ -386,6 +386,7 @@ SystemGLFrameBuffer::SystemGLFrameBuffer(void*, const bool fullscreen)
} }
} }
assert(frameBuffer == nullptr);
frameBuffer = this; frameBuffer = this;
FConsoleWindow::GetInstance().Show(false); FConsoleWindow::GetInstance().Show(false);
@ -393,6 +394,9 @@ SystemGLFrameBuffer::SystemGLFrameBuffer(void*, const bool fullscreen)
SystemGLFrameBuffer::~SystemGLFrameBuffer() SystemGLFrameBuffer::~SystemGLFrameBuffer()
{ {
assert(frameBuffer == this);
frameBuffer = nullptr;
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter]; NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
[nc removeObserver:m_window [nc removeObserver:m_window
name:NSWindowDidMoveNotification name:NSWindowDidMoveNotification