Fixed a potential Cocoa crash when closing a window
This commit is contained in:
parent
9651f2bb6b
commit
f0809a667f
@ -389,6 +389,7 @@ static void audioCallback(GB_gameboy_t *gb, GB_sample_t *sample)
|
|||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
[cameraSession stopRunning];
|
[cameraSession stopRunning];
|
||||||
|
self.view.gb = NULL;
|
||||||
GB_free(&gb);
|
GB_free(&gb);
|
||||||
if (cameraImage) {
|
if (cameraImage) {
|
||||||
CVBufferRelease(cameraImage);
|
CVBufferRelease(cameraImage);
|
||||||
|
@ -131,6 +131,7 @@ static const vector_float2 rect[] =
|
|||||||
- (void)drawInMTKView:(nonnull MTKView *)view
|
- (void)drawInMTKView:(nonnull MTKView *)view
|
||||||
{
|
{
|
||||||
if (!(view.window.occlusionState & NSWindowOcclusionStateVisible)) return;
|
if (!(view.window.occlusionState & NSWindowOcclusionStateVisible)) return;
|
||||||
|
if (!self.gb) return;
|
||||||
if (texture.width != GB_get_screen_width(self.gb) ||
|
if (texture.width != GB_get_screen_width(self.gb) ||
|
||||||
texture.height != GB_get_screen_height(self.gb)) {
|
texture.height != GB_get_screen_height(self.gb)) {
|
||||||
[self allocateTextures];
|
[self allocateTextures];
|
||||||
|
Loading…
Reference in New Issue
Block a user