Skip to content

Commit

Permalink
Fix rare crash when closing a document.
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoNatan committed Dec 5, 2018
1 parent 2fb91eb commit b981abc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions DetoxInstruments/DetoxInstruments/DTXApplicationDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ - (void)verifyLldbInitIsNotBroken
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
[[NSUserDefaults standardUserDefaults] registerDefaults:@{@"DTXProfilingConfigurationUseDefaultConfiguration": @YES}];
[[NSUserDefaults standardUserDefaults] registerDefaults:@{@"DTXSelectedProfilingConfiguration_timeLimit": @2}];
[[NSUserDefaults standardUserDefaults] registerDefaults:@{@"DTXSelectedProfilingConfiguration_timeLimitType": @1}];

if([[NSUserDefaults standardUserDefaults] boolForKey:@"DTXProfilingConfigurationUseDefaultConfiguration"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ - (NSString *)defaultDraftName
- (void)canCloseDocumentWithDelegate:(id)delegate shouldCloseSelector:(SEL)shouldCloseSelector contextInfo:(void *)contextInfo
{
#ifndef CLI
if(self.documentState < DTXRecordingDocumentStateLiveRecordingFinished)
if(self.documentState == DTXRecordingDocumentStateLiveRecording)
{
[self stopLiveRecording];
}
Expand Down Expand Up @@ -482,8 +482,11 @@ - (void)popGroup

- (void)stopLiveRecording
{
dispatch_block_cancel(_pendingCancelBlock);
_pendingCancelBlock = nil;
if(_pendingCancelBlock != nil)
{
dispatch_block_cancel(_pendingCancelBlock);
_pendingCancelBlock = nil;
}

[self remoteProfilingClientDidStopRecording:_remoteProfilingClient];

Expand Down

0 comments on commit b981abc

Please sign in to comment.