Diederik van Lierop wrote:
Revision #15307 fixes bug #1740146, in which changes in the document-properties dialog are written to the wrong document when multiple documents are open.
In registered-widget.cpp, we used to have
if (!repr) repr = SP_OBJECT_REPR (sp_desktop_namedview(dt));
but this won't update "repr" when the focus has changed to another document. Just removing the if-statement did the trick, but this is also needed for the other controls. We have two other options though:
- make "repr" a local variable instead of a class-variable.
Why should it be a class-variable after all?
- have a mechanism to notify the class of changes in the
focus and update "repr" accordingly, but I don't see a reason for doing it like this.
repr is a class variable, because these widgets are also used for things that are written elsewhere in the xml tree (for example grid variables). repr specifies where that is. When it is null, it should use the default location, which is 'SP_OBJECT_REPR (sp_desktop_namedview(dt))'. The #15307 fix bugs the 'dotted' checkbox for the XY-grid.
My code is buggy because it does not think about multiple documents: it should not use SP_ACTIVE_DESKTOP for example to retrieve the SPDocument, but it should use the repr to determine which document it is in.
I'll fixed this now. Thanks very much for uncovering this bug!!!
Cheers, Johan