bjoern.michaelsen at canonical.com
Mon Jan 11 03:48:59 PST 2016
On Sun, Jan 03, 2016 at 10:43:05AM +0100, Markus Mohrhard wrote:
> > In fact, wouldn’t a dynamic_cast be better, as this most specifically down
> > or upcasts a pointer, and returns NULL if it fails?
> That depends on all the code around it. Here the code just assumes that all
> returned SwModify objects are actually SwFormat objects.
This is the core of the issue:
- Practically everything in writer is a SwClient, and most is a SwModify too
- Instead of using this as the (already quite broken) Observer pattern
implementation, a lot of (esp. layout code) code (ab-)uses the client/modify
relation for various other relations making wild assumptions on the type of
object behind a GetRegisteredIn() or the kind of listeners an SwModify can have
> > Any advise on this would be greatly appreciated, got me thoroughly
> > tricked...
Congratulations on finding the dark secret of writer: Everything in sw is a
SwClient and those are all connected in a mad web of intrinsic double-linked
list of effective void-pointers (as m_pLeft and m_pRight in WriterListener are
WriterListeners, pRegisteredIn in SwModify is also a WriterListener and
_everthing_ of relevance in sw a WriterListener).
More information about the LibreOffice