[Bug 29606] Reduce number of needed Account becomeReady calls
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Tue Aug 31 19:18:54 CEST 2010
https://bugs.freedesktop.org/show_bug.cgi?id=29606
--- Comment #4 from Olli Salli <ollisal at gmail.com> 2010-08-31 10:18:54 PDT ---
OK it seems I noobed completing some paragraphs there :P let's retry:
(In reply to comment #3)
>
> Also note that the factories as passed to AM (and in the future also other
> proxy) ctors are ConstPtr params, and that eg. FixedFeatureFactory only ever
> allows adding features, not removing them. This means nobody can a) add
> conflicting features to make ready in an AM's factory instance accessing it
> through AM->accountFactory() etc and b) an application constructing the factory
> can't mess up
its other parts expecting a certain set of features (and having done
addFeature(s)) accordingly. Also, it's possible that the application checks the
features set on a factory against a whitelist and/or a blacklist before passing
them over to the AM/ClientRegistrar/whatever, if it wants - this is assuming it
allows some arbitrary self-contained modules to set any features in the first
place.
>
> We should of course document that the application shouldn't allow access to the
> non-const pointers to the factories after passing them to the AM/whatever
> constructor, at least not to potentially untrusted plugins. I don't think this
> is much of a problem though, as the use will naturally fall into the following
> pattern I think:
>
> {
> AccountFactoryPtr accFact = AccountFactory::create(bus)
>
> }
I mean:
private: void initAM()
{
ChannelFactoryPtr chanFact = ChannelFactory::create(bus)
// Do chanFact manipulation, whatever the API will be like
ConnectionFactoryPtr connFact = ConnectionFactory::create(bus)
connFact->addFeatures(Connection::FeatureCore | Connection::FeatureRoster)
AccountFactoryPtr accFact = AccountFactory::create(bus)
accFact->addFeature(Account::FeatureAvatar)
mPriv->am = AccountManager::create(bus, chanFact, connFact, accFact)
}
So after the end of that scope/function, the factories will go out of scope and
the only way to access them is the const access through the AM.
>
> Sorry for the missing semicolons, my custom keyboard layout and opera together
> don't allow typing that in bugzilla comments (because it's the altgr+capslock
> keys on a typical PC qwerty layout :))
>
> If you like, we can add something like isReadonly() / makeReadonly() to the
factories though, and make AM etc do makeReadonly() on the factories passed to
them and then make the addFeature etc setters warn/assert if isReadonly().I
don't think they should return a bool or anything though as it's not really a
runtime error, it's a programming error. This would make it even more "secure"
but maybe it's going overboard a bit already.
--
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
More information about the telepathy-bugs
mailing list