hoffstadt / hoffstadt/DearPyGui
`capture_next_item`: `user_data` is not passed to callback, item is not rendered
- 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
Assessment
This issue has not been assessed yet.