[Libreoffice] [REVIEW] fix for fdo#36690

Kohei Yoshida kyoshida at novell.com
Thu May 19 21:39:25 PDT 2011


Hi there,

The attached patch fixes

https://bugs.freedesktop.org/show_bug.cgi?id=36690

and I would like to push this to the -3-4 branch and possibly to the
-3-4-0 branch as well.  The patch is against vcl.

Calc races during print preview when the sheet contains buttons with
colors.  The reason is as follows:

1. Print preview, which is the output device, tries to paint its own
window which draws the buttons.  (ScPreview implements the print preview
window for Calc.)
2. PushButton::Draw() updates the style setting of the output device in
order to change the face color by calling SetSettings() of the output
device.
3. SetSettings() is virtual (!), and Window::SetSettings() receives the
call instead of OutputDevice::SetSettings().
4. Window::SetSettings() calls DataChanged() virtual method to broadcast
the setting change.
5. ScPreView::DataChanged() receives this, sees the style has changed,
and tries to re-paint the whole thing.
6. The cycle continues. :-(

When the PushButton::Draw changes the style setting, I'm pretty sure it
never intends to broadcast the change to anyone, yet it does because
SetSettings is virtual.  So what my patch does is to allow it to simply
change the style setting without broadcasting it, and that's enough to
end this infinite re-paint cycle.

As an aside, it really bugs me to have a simple accessor method being
virtual, but that's another story...

Reviews appreciated.

Kohei

-- 
Kohei Yoshida, LibreOffice hacker, Calc
<kyoshida at novell.com>


More information about the LibreOffice mailing list