Fixed Cocoa memory leak

This commit is contained in:
Lior Halphon 2016-07-20 23:26:54 +03:00
parent 1d35c04ab1
commit b740b7f3ba
2 changed files with 5 additions and 0 deletions

View File

@ -126,6 +126,7 @@ static uint32_t rgbEncode(GB_gameboy_t *gb, uint8_t r, uint8_t g, uint8_t b)
GB_run(&gb); GB_run(&gb);
} }
[self.audioClient stop]; [self.audioClient stop];
self.audioClient = nil;
self.view.mouseHidingEnabled = NO; self.view.mouseHidingEnabled = NO;
GB_save_battery(&gb, [[[self.fileName stringByDeletingPathExtension] stringByAppendingPathExtension:@"sav"] UTF8String]); GB_save_battery(&gb, [[[self.fileName stringByDeletingPathExtension] stringByAppendingPathExtension:@"sav"] UTF8String]);
stopping = false; stopping = false;

View File

@ -160,6 +160,10 @@ void main(void) {\n\
glDeleteProgram(program); glDeleteProgram(program);
glDeleteTextures(1, &texture); glDeleteTextures(1, &texture);
glDeleteTextures(1, &previous_texture); glDeleteTextures(1, &previous_texture);
/* OpenGL is black magic. Closing one view causes others to be completely black unless we reload their shaders */
/* We're probably not freeing thing in the right place. */
[[NSNotificationCenter defaultCenter] postNotificationName:@"GBFilterChanged" object:nil];
} }
+ (GLuint)shaderWithContents:(NSString*)contents type:(GLenum)type + (GLuint)shaderWithContents:(NSString*)contents type:(GLenum)type