ActiveDispatcher saves reference to event context after event was performed until it gets new event. So if I pass smart pointer as argument of ActiveMethod with ActiveDispatcher. I can't remove object until I call any ActiveMethod for the same ActiveDispatcher.
I fixed it in my local build:
void ActiveDispatcher::run()
{
AutoPtr pNf = _queue.waitDequeueNotification();
while (pNf && !dynamic_cast<StopNotification*>(pNf.get()))
{
{
MethodNotification* pMethodNf = dynamic_cast<MethodNotification*>(pNf.get());
poco_check_ptr (pMethodNf);
ActiveRunnableBase::Ptr pRunnable = pMethodNf->runnable();
pRunnable->duplicate(); // run will release
pRunnable->run();
pNf = nullptr;
}
pNf = _queue.waitDequeueNotification();
}
}