hoffstadt / hoffstadt/DearPyGui

`capture_next_item`: `user_data` is not passed to callback, item is not rendered

Open
#2,138 0 comments 0 reactions 0 assignees View on GitHub
state: pending type: bug
Dominant language
C++
Stars
15.6k
Forks
783
PR merge metrics
No merged PRs in 30d

Description

DearPyGui v1.9.1
Windows 10/11

`capture_next_item` accepts a `user_data` argument that is supposed to be sent the included *callback*. However, the third positional argument `user_data` is always None when called by DearPyGui. This is because `AddItemWithRuntimeChecks` in `mvItemRegistry.cpp`
sends `nullptr` to `mvRunCallback` instead of `captureCallbackUserData`.

```c++
b8
AddItemWithRuntimeChecks(mvItemRegistry& registry, std::shared_ptr item, mvUUID parent, mvUUID before)
{

if(registry.captureCallback)
{

// this is a unique situation in that the caller always has the GIL
registry.capturedItem = item;
mvRunCallback(registry.captureCallback, registry.capturedItem->uuid, nullptr, nullptr); // this
Py_XDECREF(registry.captureCallback);
registry.captureCallback = nullptr;
return true; // also this?
}
...
}
```

The conditional also returns early, so the item will exist registry but that's about all it does - everything else is skipped. Removing the early return fixes this, but is it there purposefully?

These are easy fixes. I can include them in my upcoming PR?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.