Skip to content

Commit

Permalink
Fixed bug (freezing of screen after start of timer)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sumukh committed Feb 4, 2012
1 parent 347c46b commit 47e460f
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions TimerWindowController.m
Expand Up @@ -192,20 +192,27 @@ - (void)updateTimerDisplay:(NSTimer*)timer {
[timerLabel_ sizeToFit];
[self resetStrikes];

if(isLeopard && [[NSUserDefaults standardUserDefaults] boolForKey: @"BadgeApplicationIcon"]) {
// We want to round up the minutes--standard when we aren't displaying seconds.
if(numSeconds > 0 && numMinutes != 59)

if(isLeopard && [[NSUserDefaults standardUserDefaults] boolForKey: @"BadgeApplicationIcon"])

{
// We want to round up the minutes--standard when we aren't displaying seconds.
//previous freeze occuring here after starting time, brackets fixed issue
if(numSeconds > 0 && numMinutes != 59) {
numMinutes++;
NSString* badgeString = [NSString stringWithFormat: @"%0.2d:%0.2d",
numHours,
numMinutes];
NSString* badgeString = [NSString stringWithFormat: @"%0.2d:%0.2d", numHours, numMinutes];
[[NSApp dockTile] setBadgeLabel: badgeString];
} else if(isLeopard) {

}

else if(isLeopard) {
// If we're on Leopard but aren't using badging, set the badge string to be
// empty to remove any badge if there is one.
[[NSApp dockTile] setBadgeLabel: @""];
}
}
}
}


- (void)windowShouldClose:(NSNotification *)notification {
// Hack to make the application terminate after the last window is closed, but
Expand Down

1 comment on commit 47e460f

@cstigler
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the work on this, and the other commits seem like good ideas. But this particular commit is buggy and will cause some issues if we merge it.

Can somebody clarify for me what this "freezing bug" is and why it was fixed by this? I don't think I've ever experienced this, but if it is an issue we should figure out how to fix it properly. If this commit does fix anything, it is because it inadvertently breaks a piece of the code that contains a bug.

Problems with this commit:

  • By moving the setBadgeLabel call inside the if(numSeconds > 0 && numMinutes != 59) statement, you've made it so that the badge will fail to update when the block has 59 minutes remaining or when the method is called at the top of a minute.
  • The clause to clear the badge label when we aren't using badging has been moved to the wrong scope. That else statement previously matched the higher level if statement. This means this statement will never be executed, and therefore the badge label will not be cleared when badging is turned off.

If you know where it's freezing, let me know and we can look for ways to fix it. I don't think this commit is a good response.

Please sign in to comment.