From 5dcc8e744e4be65930240b9414db0eaec15596d2 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Sat, 14 Jan 2017 19:45:07 +0200 Subject: [PATCH] Fixed a crash in the Cocoa port that might happen after closing GameBoy Camera --- Cocoa/Document.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cocoa/Document.m b/Cocoa/Document.m index 19b826d..d0c23d7 100644 --- a/Cocoa/Document.m +++ b/Cocoa/Document.m @@ -266,6 +266,7 @@ static void printImage(GB_gameboy_t *gb, uint32_t *image, uint8_t height, - (void)dealloc { + [cameraSession stopRunning]; GB_free(&gb); if (cameraImage) { CVBufferRelease(cameraImage); @@ -866,7 +867,6 @@ static void printImage(GB_gameboy_t *gb, uint32_t *image, uint8_t height, [cameraSession addInput: input]; [cameraSession addOutput: cameraOutput]; - /* ARC will stop the session when the window is closed. */ [cameraSession startRunning]; cameraConnection = [cameraOutput connectionWithMediaType: AVMediaTypeVideo]; }