Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 18, 2010, 1:52:55 AM (14 years ago)
Author:
landauf
Message:

fixed a potential problem introduced in r7158 - calling an executor on a temporary object shouldn't change the internal state of the underlying functor.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/libraries/core/Executor.h

    r7163 r7177  
    183183            bool parse(T* object, const std::string& params, const std::string& delimiter = " ") const
    184184            {
    185                 static_cast<FunctorMember<T>*>(this->functor_)->setObject(object);
    186                 if (Executor::parse(params, delimiter))
    187                     return true;
    188                 else
    189                 {
    190                     static_cast<FunctorMember<T>*>(this->functor_)->setObject((T*)NULL);
    191                     return false;
    192                 }
     185                FunctorMember<T>* functorMember = static_cast<FunctorMember<T>*>(this->functor_);
     186
     187                const typename FunctorMember<T>::Objects& objects = functorMember->getObjects();
     188
     189                functorMember->setObject(object);
     190                bool result = Executor::parse(params, delimiter);
     191                functorMember->setObjects(objects);
     192
     193                return result;
    193194            }
    194195
    195196            bool parse(const T* object, const std::string& params, const std::string& delimiter = " ") const
    196197            {
    197                 static_cast<FunctorMember<T>*>(this->functor_)->setObject(object);
    198                 if (Executor::parse(params, delimiter))
    199                     return true;
    200                 else
    201                 {
    202                     static_cast<FunctorMember<T>*>(this->functor_)->setObject((T*)NULL);
    203                     return false;
    204                 }
     198                FunctorMember<T>* functorMember = static_cast<FunctorMember<T>*>(this->functor_);
     199
     200                const typename FunctorMember<T>::Objects& objects = functorMember->getObjects();
     201
     202                functorMember->setObject(object);
     203                bool result = Executor::parse(params, delimiter);
     204                functorMember->setObjects(objects);
     205
     206                return result;
    205207            }
    206208    };
Note: See TracChangeset for help on using the changeset viewer.