using namespace effect;
typedef vector<const SGPropertyNode*> RawPropVector;
-typedef map<const string, observer_ptr<Effect> > EffectMap;
+typedef map<const string, ref_ptr<Effect> > EffectMap;
namespace
{
lock(effectMutex);
cache = parent->getCache();
itr = cache->find(key);
- if (itr != cache->end()) {
- effect = itr->second.get();
- if (effect.valid())
- effect->generator = parent->generator; // Copy the generators
+ if ((itr != cache->end())&&
+ itr->second.lock(effect))
+ {
+ effect->generator = parent->generator; // Copy the generators
}
}
if (!effect.valid()) {
pair<Effect::Cache::iterator, bool> irslt
= cache->insert(make_pair(key, effect));
if (!irslt.second) {
- ref_ptr<Effect> old = irslt.first->second.get();
- if (old.valid())
+ ref_ptr<Effect> old;
+ if (irslt.first->second.lock(old))
effect = old; // Another thread beat us in creating it! Discard our own...
else
irslt.first->second = effect; // update existing, but empty observer