some notes on SwClient and SwModify

Bjoern Michaelsen bjoern.michaelsen at canonical.com
Mon Mar 23 02:57:29 PDT 2015


Hi,

On Mon, Mar 23, 2015 at 10:27:29AM +0100, Bjoern Michaelsen wrote:
> On Mon, Mar 23, 2015 at 09:54:45AM +0100, Miklos Vajna wrote:
> > /home/vmiklos/git/libreoffice/master-clang/sw/source/core/doc/docfmt.cxx:657:26: error: c-style cast, type=5, from='const sw::WriterListener *', to='SwClient *', recommendedFix=static_cast [loplugin:cstylecast]
> >     while( 0 != ( pDep = (SwClient*)aCallMod.GetDepends()) )

just adding quickly: All of that btw seems to be a workaround for the weird API
discussed: One would assume you could call something like:

 aCallMod.CallSwClientNotify(aDeregisterFromMeNowHint);

and universally cause Clients to deregister. There is something almost like that
historically:

 SwPtrMsgPoolItem aDying(RES_OBJECT_DYING, aCallMod);
 aCallMod.ModifyBroadcast(nullptr, aDying);

... however, it has the nasty side effect of reregistering the clients of the
"dying" object at the SwModify the "dying" object was registered itself. Thats
really not expected behaviour. It seems though, that instead of creating a sane
"deregister" hint, that triggers some more obvious behaviour, people just
played around with the private parts of the SwModify/SwClient classes(*).

Best,

Bjoern

(*) This might have been reenforced by "if I touch calbck.hxx, I need to
recompile all of sw/, OMG dont want to do that." avoidance strategies back in
the days.


More information about the LibreOffice mailing list