[Libreoffice] [PATCH] ScGlobal::GetAutoFormat not always required to create fresh instance

Kohei Yoshida kohei.yoshida at suse.com
Fri Jan 6 17:07:19 PST 2012

On Fri, 2012-01-06 at 19:03 +0100, Stephan Bergmann wrote:

> So, I would appreciate it if some Calc aficionado could look at the 
> patch, whether it actually makes any sense.

First, I have to say all this auto format code is not something I'm
familiar with.  So, my opinion is based on what I gathered in the past
~10 minutes of reading how the global ScAutoFormat instance is used
throughout the calc code.  I'm CC'ing Eike in case my answer is off the

Anyway, it's my understanding that the main problem is that the global
ScAutoFormat instance unintentionally get instantiated in the destructor
of ScAutoFormatObj during the termination of the cppunit?  In that case,
what I would do is to add ScGlobal::HasAutoFormat() which simply checks
whether the instance already exists, and if yes go on ahead and save if
the flag is set.  When no such instance exists there is no need to save
stuff anyway (since there is no data to save).

Another advantage of this is that we wouldn't have to modify all the
code that currently uses GetAutoFormat() expecting it to return a live
instance at all times, and we could only modify the code in

Would that solve the problem you are facing?


Kohei Yoshida, LibreOffice hacker, Calc

More information about the LibreOffice mailing list