rive-app / rive-app/rive-runtime

`CommandQueue::referenceListViewModelInstance` stores parent VMI handle on listener but registers it under the child handle

Open Beginner friendly
#95 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
1.2k
Forks
121
PR merge metrics
No merged PRs in 30d

Description

In src/command_queue.cpp (line 326 in current HEAD on main; same code present in rive-ios 6.19.1's bundled runtime), CommandQueue::referenceListViewModelInstance looks like:

ViewModelInstanceHandle CommandQueue::referenceListViewModelInstance(
    ViewModelInstanceHandle handle,
    std::string path,
    int index,
    ViewModelInstanceListener* listener,
    uint64_t requestId)
{
    auto viewHandle = reinterpret_cast<ViewModelInstanceHandle>(
        ++m_currentViewModelHandleIdx);
    if (listener)
    {
        assert(listener->m_handle == RIVE_NULL_HANDLE);
        listener->m_handle = handle;             // parent VMI handle (input)
        listener->m_owningQueue = ref_rcp(this);
        registerListener(viewHandle, listener);  // child VMI handle (newly allocated)
    }
    ...
    return viewHandle;
}

listener->m_handle is set to handle (the parent passed in), but registerListener is keyed on viewHandle (the freshly-allocated child handle that's also the function's return value). The sibling functions in the same file — referenceNestedViewModelInstance, and both instantiateViewModelInstanceNamed overloads — set listener->m_handle = viewHandle so the two sides agree.

Is the divergence here intentional, or should line 326 also use viewHandle? Happy to send a one-line patch if it's the latter.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/command_queue.cpp at CommandQueue::referenceListViewModelInstance and compare its listener handle assignment with referenceNestedViewModelInstance and both instantiateViewModelInstanceNamed overloads. Trace how registerListener uses the handle and confirm the listener and registration keys stay consistent; done means the behavior is intentional or the discrepancy is corrected and validated with the relevant runtime tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.