diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2022-06-21 15:23:29 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2022-06-21 15:23:29 -0400 |
commit | fdc0257acbde5a2d5bb201efcc8bb723df09daf8 (patch) | |
tree | e2ad75447d0f54777814744a00b3234a5c5a1d43 /indra/llcommon/lleventdispatcher.h | |
parent | 490de3ab6e3a2b9dd8668c2093e265f36324f82e (diff) |
DRTVWR-564: Fix LLEventDispatcher::addMethod() for LazyEventAPI.
A classic LLEventAPI subclass calls LLEventDispatcher::add() methods in its
own constructor. At that point, addMethod() can reliably dynamic_cast its
'this' pointer to the new subclass.
But because of the way LazyEventAPI queues up add() calls, they're invoked in
the (new) LLEventAPI constructor itself. The subclass constructor body hasn't
even started running, and LLEventDispatcher::addMethod()'s dynamic_cast to the
LLEventAPI subclass returns nullptr. addMethod() claims the new subclass isn't
derived from LLEventDispatcher, which is confusing since it is.
It works to change addMethod()'s dynamic_cast to static_cast.
Flesh out lazyeventapi_test.cpp. post() maps with "op" keys to actually try to
engage the registered operation. Give the operation an observable side effect;
use ensure_mumble() to verify. Also verify that LazyEventAPI has captured the
subject LLEventAPI's metadata in a way we can retrieve.
Diffstat (limited to 'indra/llcommon/lleventdispatcher.h')
-rw-r--r-- | indra/llcommon/lleventdispatcher.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/indra/llcommon/lleventdispatcher.h b/indra/llcommon/lleventdispatcher.h index ce9d3775cc..2e140329f3 100644 --- a/indra/llcommon/lleventdispatcher.h +++ b/indra/llcommon/lleventdispatcher.h @@ -329,7 +329,7 @@ private: void addMethod(const std::string& name, const std::string& desc, const METHOD& method, const LLSD& required) { - CLASS* downcast = dynamic_cast<CLASS*>(this); + CLASS* downcast = static_cast<CLASS*>(this); if (! downcast) { addFail(name, typeid(CLASS).name()); |