gabrielzschmitz / Tomato.C

A pomodoro timer written in pure C.
GNU General Public License v3.0
315 stars 19 forks source link

Strange behavior after starting a new Pomodoro cycle after another already completed #48

Closed CarlosCraveiro closed 5 months ago

CarlosCraveiro commented 5 months ago

The Problem:

This one (bug) was difficult to capture. But, sometimes after finishing one Pomodoro Cycle and starting a new one, instead of pomodoro, the cycle starts with pause.

I don't know exactly how to reproduce the bug. But maybe it's involved to some key I'm accidentally pressing. Sometimes I fumble with app shortcuts.

annoying_bug

CarlosCraveiro commented 5 months ago

Now watching the giff calmly it looks like he just skipped work-time...I came across this bug a few days ago and I ran into it again today and tried to register to see if I wasn't going crazy. I'll take a look at the code and see if I can find anything, maybe it's not even a bug.

gabrielzschmitz commented 5 months ago

Looks like it's fixed:

--- update.c    2024-03-27 20:39:21.507360980 -0300
+++ update.c    2024-03-27 20:39:26.103969415 -0300
@@ -205,6 +205,7 @@
     app->pomodoroCounter = 0;
     if (TIMERLOG == 1) endTimerLog(app);
     notify("end");
+    app->timer = 0;
   }

   /* Beach Animation */

The problem was that sometimes app->timer was less than 0 at end of long pause. And then not being reseted to the worktime at input.c line 881:

      if (app->timer == 0) app->timer = app->workTime;