[Libreoffice] Questions about Timers

Caolán McNamara caolanm at redhat.com
Thu Nov 18 01:14:21 PST 2010

On Wed, 2010-11-17 at 23:13 +0100, Julien Nabet wrote:
> Hello,
> In the easy hacks, could it be possible to have more information on what 
> to do with timers ?
> For example :
> - what's a "leaked timer", is it the same as "permanent timer" that i 
> read on this http://qa.openoffice.org/issues/show_bug.cgi?id=106485 ?
> - how to find a leaked timer ?

In vcl/source/app/timer.cxx stick a printf and gdb breakpoint at
Timer::Timeout. Run the app, e.g. starmath, draw, impress, etc. 

Now, there's absolutely nothing wrong with timeouts. What's wrong is a
timeout that gets triggered for some condition and then never ends,
doing nothing at each timeout. 

> - how to correct them ? (must we delete them or change them ?)

Generally change them to come to a halt when whatever they want to do is
complete, and restart them if that condition arises again.

> For example, the timer mpOnlineSpellingTimer that we can find in these 
> files :
> impress/sd/inc/drawdoc.hxx
> impress/sd/source/core/drawdoc4.cxx
> impress/sd/source/core/drawdoc.cxx
> Is this timer ok ? Is there something we can improve/optimize in it ?

This depends, and I think I made some modifications to that specific one
to fix it. What would happen is that changing/adding text would trigger
the spell checking time out, which was good, but when the spellcheck was
complete the timer would continue to timeout, wake up the processor,
find out that nothing new had been changed to spellcheck, go back and
snooze for a while, wake up, etc. So right fix was to end the timer when
the spellcheck was complete and launch a new one when text was modified

Draw/Impress has a timer which unloads some resources after some time,
that's ok, it gets fired one and then goes away. I think the
spellchecking timers in sd and impress are good and eventually stop when
they're finished. calc and writer on the other hand are still
problematic, maybe quite hard to fix. If you look at calc I think it has
a timer which is launched off when calc is first started, and then that
timer never ends, even when calc is actually closed down :-)


More information about the LibreOffice mailing list