bugfix: segfault in Grid.at() due to internal types not exported to module
After #184/#189 made GridPoint and GridPointState internal-only types, code using PyObject_GetAttrString(mcrf_module, "GridPoint") would get NULL and crash when dereferencing. Fixed by using the type directly via &mcrfpydef::PyUIGridPointType instead of looking it up in the module. Affected functions: - UIGrid::py_at() - UIGridPointState::get_point() - UIEntity::at() - UIGridPointState_to_PyObject() 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
f9b6cdef1c
commit
a4c2c04343
3 changed files with 8 additions and 16 deletions
|
|
@ -1182,8 +1182,8 @@ PyObject* UIGrid::py_at(PyUIGridObject* self, PyObject* args, PyObject* kwds)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
//PyUIGridPointObject* obj = (PyUIGridPointObject*)((&PyUIGridPointType)->tp_alloc(&PyUIGridPointType, 0));
|
||||
auto type = (PyTypeObject*)PyObject_GetAttrString(McRFPy_API::mcrf_module, "GridPoint");
|
||||
// Use the type directly since GridPoint is internal-only (not exported to module)
|
||||
auto type = &mcrfpydef::PyUIGridPointType;
|
||||
auto obj = (PyUIGridPointObject*)type->tp_alloc(type, 0);
|
||||
//auto target = std::static_pointer_cast<UIEntity>(target);
|
||||
// #123 - Use at() method to route through chunks for large grids
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue