Skip to content
This repository was archived by the owner on Feb 19, 2020. It is now read-only.

Commit 2f1cd0a

Browse files
author
Benjamin Scholtysik (Reimold)
authored
Merge pull request #37 from bitstadium/fix/fix-deadlock-in-BITChannel
Fix the deadlock in BITChannel
2 parents 657987e + f05dc80 commit 2f1cd0a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Classes/BITChannel.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,12 +298,14 @@ - (void)enqueueTelemetryItem:(BITTelemetryData *)item completionHandler:(nullabl
298298
return;
299299
}
300300

301+
// Should be outside of @synchronized block!
302+
BOOL applicationIsInBackground = ([BITHockeyHelper applicationState] == BITApplicationStateBackground);
303+
301304
// Enqueue item.
302305
@synchronized(self) {
303306
NSDictionary *dict = [strongSelf dictionaryForTelemetryData:item];
304307
[strongSelf appendDictionaryToEventBuffer:dict];
305308
// If the app is running in the background.
306-
BOOL applicationIsInBackground = ([BITHockeyHelper applicationState] == BITApplicationStateBackground);
307309
if (strongSelf.dataItemCount >= strongSelf.maxBatchSize || applicationIsInBackground) {
308310

309311
// Case 2: Max batch count has been reached or the app is running in the background, so write queue to disk and delete all items.

0 commit comments

Comments
 (0)