[boost-users][StateChart] polymorphic_downcast failure

Hi, The above failure occurs in reaction_dispatcher::derived_with_action::react(). IIUC, state_machine tries to invoke in_state_reaction that's defined for an event, which is unrelated to the one being processed. What logical error in my state-machine might cause such a problem? Unfortunately, I don't have any self-contained code at the moment, so please treat my question as theoretical :). Thanks.

The problem is found. The event was defined incorrectly: struct A : sc::event<B>; The event B was actually posted, while the in_state_reaction was defined for A.

The problem is found. The event was defined incorrectly: struct A : sc::event<B>;
I was just in the process of mentioning this :-). Regards, -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.

The problem is found. The event was defined incorrectly: struct A : sc::event<B>;
I was just in the process of mentioning this :-).
By the way, isn't it worth verifying in compile-time that MostDerived is actually the most derived? Or there's no way to do this?

By the way, isn't it worth verifying in compile-time that MostDerived is actually the most derived?
At compile time, you could verify that A is a subclass of sc::event<A>, but that doesn't stop you to define your events as follows ... struct A : sc:event<A> {}; struct B : sc::event<A> {}; ... which (I guess) was what you have run into? Regards, -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.

At compile time, you could verify that A is a subclass of sc::event<A>, but that doesn't stop you to define your events as follows ...
struct A : sc:event<A> {}; struct B : sc::event<A> {};
... which (I guess) was what you have run into?
Yes, that was my case. Copy&paste is evel :(

Hi Igor
The above failure occurs in reaction_dispatcher::derived_with_action::react().
Such a failure usually means that the involved event has had its destructor called. How do you allocate events? On the stack or with new and intrusive_ptr?
IIUC, state_machine tries to invoke in_state_reaction that's defined for an event, which is unrelated to the one being processed. What logical error in my state-machine might cause such a problem?
I've never seen any other causes than the one I mentioned above. If you can rule that out then I'll need code I can debug. HTH & Regards, -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.
participants (2)
-
Andreas Huber
-
Igor R