Skip to content

Commit

Permalink
Fix an assertion failure with progress indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
barijaona committed Jun 4, 2016
1 parent 89efe99 commit 07975ea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/AppController.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
NSMutableDictionary * scriptPathMappings;
NSMenu * appDockMenu;
NSStatusItem * appStatusItem;
NSInteger progressCount;
BOOL isProgressAnimatorActive;
NSDictionary * standardURLs;
NSTimer * checkTimer;
NSInteger lastCountOfUnread;
Expand Down
14 changes: 8 additions & 6 deletions src/AppController.m
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ -(instancetype)init
if ((self = [super init]) != nil)
{
scriptPathMappings = [[NSMutableDictionary alloc] init];
progressCount = 0;
isProgressAnimatorActive = NO;
persistedStatusText = nil;
lastCountOfUnread = 0;
appStatusItem = nil;
Expand Down Expand Up @@ -3900,20 +3900,22 @@ -(void)sendBlogEvent:(NSString *)externalEditorBundleIdentifier title:(NSString
*/
-(void)startProgressIndicator
{
if (progressCount++ == 0)
if (!isProgressAnimatorActive) {
[spinner startAnimation:self];
isProgressAnimatorActive = YES;
}
}

/* stopProgressIndicator
* Stops the progress indicator on the info bar running
*/
-(void)stopProgressIndicator
{
NSAssert(progressCount > 0, @"Called stopProgressIndicator without a matching startProgressIndicator");
if (--progressCount < 1)
NSAssert(isProgressAnimatorActive, @"Called stopProgressIndicator without a matching startProgressIndicator");
if (isProgressAnimatorActive)
{
[spinner stopAnimation:self];
progressCount = 0;
isProgressAnimatorActive = NO;
}
}

Expand Down Expand Up @@ -4547,7 +4549,7 @@ -(NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *

//Ensure the spinner has the proper state; it may be added while we're refreshing
if (APP.refreshing)
[spinner startAnimation:self];
[self startProgressIndicator];
}
else
{
Expand Down

0 comments on commit 07975ea

Please sign in to comment.