On Fri, 2014-01-24 at 17:36 +0100, Stephan Bergmann wrote: > On 01/23/2014 10:29 AM, Matúš Kukan wrote: > > On Fri, 2014-01-17 at 10:18 +0100, Stephan Bergmann wrote: > >> On 01/16/2014 06:52 PM, Stephan Bergmann wrote: > > Ah, so it seems that Singleton::get(context).instance does not work > > always. In framework, there are many one instance services, and when I > > tried to use static Singleton class in ctor function for e.g. > > framework::Desktop, I get various crashes on atexit. > > Yes, as stated on IRC, "in the old scheme, disposing the service mgr it > would have disposed the implementation's singleinstancefactory object, > which would have destroyed the singleton object; we need to mimic that > via the singleton object now implementing XComoponent (which the service > mgr will call when it gets disposed) wherever necessary."
Ah, ok, now I think I understand :-) > >>> ...as they are not only called from the service manager (which takes care > >>> of > >>> singleton constructor functions since > >>> 997d21183322a0a94b96868073808841d2773902 > >>> "Support for singleton constructor functions") but potentially also > >>> directly > >>> from cppumaker-generated code (which is the raison d'être for constructor > >>> functions, after all). > > > > AFAICS singletons in generated code don't use constructor functions yet. > > Right, that's still missing. Do you want to add that (otherwise, I > could see to do it sometime next week)? Yes, I will add that. > > And maybe it's a good thing. > > We could use always context->getValueByName("/singletons/<name>"); and > > it would work ? > > After changing > > css::uno::XInterface *inst = Singleton::get(context).instance.get(); > > inst->acquire(); > > return inst; > > back to > > return cppu::acquire(new SfxGlobalEvents_Impl(context)); > > But that would completely deprive us of the benefits of using > constructor functions for singletons in the first place. Right, I was confused with disposing, deleting c++ objects etc. It's proly pointless to explain how, it wouldn't make sense anyway :-) So, we just need to use true singletons and it will work. Thanks, Matus _______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice