Skip to content
Snippets Groups Projects
  • Nat Goodspeed's avatar
    fdc0257a
    DRTVWR-564: Fix LLEventDispatcher::addMethod() for LazyEventAPI. · fdc0257a
    Nat Goodspeed authored
    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.
    fdc0257a
    History
    DRTVWR-564: Fix LLEventDispatcher::addMethod() for LazyEventAPI.
    Nat Goodspeed authored
    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.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.