Vadim Zeitlin
unread,Jun 14, 2026, 6:53:41 PM (9 days ago) Jun 14Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to wx-...@googlegroups.com
On Sun, 14 Jun 2026 13:35:17 -0700 (PDT) 'wsu' via wx-dev wrote:
w> I am trying to create a concrete class that implements the
w> wxTopLevelWindow::GeometrySerializer() interface, but I have run into a
w> problem: The wxTopLevelWindow::GeometrySerializer::SaveField() function is
w> declared const, and the
w> wxTopLevelWindow::GeometrySerializer::RestoreField() function is declared
w> non-const. This looks backwards to me. I expect SaveField() to write data
w> into the backing store, and RestoreField() to read data from the backing
w> store.
Yes, this is a mistake :-( I must have been thinking about const-ness at
the level of the TLW whose geometry is being saved/restored, but this is,
of course, irrelevant from GeometrySerializer-derived class point of view.
w> Am I misunderstanding how the interface is intended to be used? If not, is
w> it too late to make the non-backwards-compatible change of reversing the
w> const declarations?
I think we can risk changing this (in 3.3 only, of course) because this
class is relatively new and a code search doesn't find a lot of its users
(but someone had already run into this problem but just left a not very
flattering comment in their code instead of/without reporting the bug).
Alternative would be to deprecate {Save,Restore}Field() functions and add
some new {Save,Restore}Value() with proper const-ness forwarding to the old
functions by default for compatibility, but this would be
1. Ugly
2. New functions wouldn't be pure virtual
so it doesn't look like a good idea.
But wait, maybe we could entirely deprecate GeometrySerializer instead and
add a new class with the correct semantics? I think this would work nicely,
although we'd still need to change the function names too. Does anybody
have a nice name for the new class? GeometryStore maybe? GeometryPersistor?
Thanks,
VZ