Skip to content

Commit

Permalink
Fix a potential crash upon pausing in iOS and macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
LIJI32 committed May 31, 2024
1 parent 2bf8feb commit b1fec62
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
3 changes: 1 addition & 2 deletions Cocoa/Document.m
Original file line number Diff line number Diff line change
Expand Up @@ -564,8 +564,7 @@ - (void)postRun
{
[_hexTimer invalidate];
[_audioLock lock];
memset(_audioBuffer, 0, (_audioBufferSize - _audioBufferPosition) * sizeof(*_audioBuffer));
_audioBufferPosition = _audioBufferNeeded;
_audioBufferPosition = _audioBufferNeeded = 0;
[_audioLock signal];
[_audioLock unlock];
[_audioClient stop];
Expand Down
5 changes: 1 addition & 4 deletions iOS/GBViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -891,10 +891,7 @@ - (UIImage *)imageFromData:(NSData *)data width:(unsigned)width height:(unsigned
- (void)postRun
{
[_audioLock lock];
if (_audioBuffer) {
memset(_audioBuffer, 0, (_audioBufferSize - _audioBufferPosition) * sizeof(*_audioBuffer));
}
_audioBufferPosition = _audioBufferNeeded;
_audioBufferPosition = _audioBufferNeeded = 0;
[_audioLock signal];
[_audioLock unlock];
[_audioClient stop];
Expand Down

0 comments on commit b1fec62

Please sign in to comment.