# Timer problem

**URL:** <https://forum.juce.com/t/timer-problem/3033>\
**Category:** General JUCE discussion\
**Created:** [July 15, 2008, 11:44am UTC](https://forum.juce.com/t/timer-problem/3033 "2008-07-15T11:44:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![atom](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/atom/32/113_2.png) [@atom](https://forum.juce.com/u/atom)\
**Post date:** [July 15, 2008, 11:44am UTC](https://forum.juce.com/t/timer-problem/3033/1 "2008-07-15T11:44:00Z")

</div>

i get this assertion sometimes, when closing a host with a plugin that has a sync thread [http://code.google.com/p/sklepseq/source/browse/trunk/xsync.cpp](http://code.google.com/p/sklepseq/source/browse/trunk/xsync.cpp)

it says to inform you 🙂 so i am.

```auto
    void removeTimer (Timer* const t) throw()
    {
#ifdef JUCE_DEBUG
        Timer* tt = firstTimer;
        bool found = false;

        while (tt != 0)
        {
            if (tt == t)
            {
                found = true;
                break;
            }

            tt = tt->next;
        }

        // trying to remove a timer that's not here - shouldn't get to this point,
        // so if you get this assertion, let me know!
        jassert (found);
#endif
```

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [July 15, 2008, 1:17pm UTC](https://forum.juce.com/t/timer-problem/3033/2 "2008-07-15T13:17:08Z")

</div>

Well, that should only ever get hit if something goes very wrong. Maybe you’ve left some dangling objects after the plugin has been closed? First check that you’ve got no memory leaks, and that all your threads have stopped cleanly.

---

<div class="post-metadata">

**Author:** ![kunitoki](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/kunitoki/32/15_2.png) [@kunitoki](https://forum.juce.com/u/kunitoki)\
**Post date:** [July 15, 2008, 4:06pm UTC](https://forum.juce.com/t/timer-problem/3033/3 "2008-07-15T16:06:04Z")

</div>

i’ve reached that too, was a reentrant callback from the audio thread which was calling my registered stop callback twice after it already stopped…

very hard to figure out !! as Jules said, double check function calls, maybe you have something that calls your function when it doesn’t (i’ve pushed a DBG(“MyFunctionName”) in every entry point of every functions to check this). also, be sure you don’t have some Threads hanging around…
