Closed mgerhardy closed 2 months ago
Thank you! I pushed the fix b7e8d66 and I am now investigating how to better detect those issues and sturdy code against them.
Following this I did the aggressive move of pushing 7bcdcdb d905355 & co. aka
- TestEngine: *EXCEPTIONALLY BREAKING CHANGE*
Changed ItemInfo(), WindowInfo() and variants signatures to return
a full ImGuiTestItemInfo struct instead of a pointer.
Before:
ImGuiTestItemInfo* ItemInfo(ImGuiTestRef ref, ....);
ImGuiTestItemInfo* WindowInfo(ImGuiTestRef window_ref, ...);
After:
ImGuiTestItemInfo ItemInfo(ImGuiTestRef ref, ....);
ImGuiTestItemInfo WindowInfo(ImGuiTestRef window_ref, ...);
- The initial design suggested that the data could be updated on subsequent
frames, but it technically required to manipulate the RefCount field and it was
very easy to get wrong and mistakes were difficult to notice and debug,
occasionally leading to dangling pointers.
- We are instead returning a copy of the value at the current time.
You may call ItemInfo()/WindowInfo() again if you need refreshed values.
item = ItemInfo(item.ID); // refresh values
- If you were using info->RefCount++/info->RefCount-- is likely means that
you wanted to reuse an ItemInfo pointers accross frames and might
want to request the refreshed data.
- Removed the ImGuiTestItemInfo::RefCount field since it is now unused,
and its removal makes it easier to spot cases that might need fixing.
APOLOGIES FOR THE BREAKING CHANGE.
PLEASE CONTACT US IF YOU HAVE ISSUES OR FEEDBACK OR ANY QUESTION.
This will prevent this class of issue and I think the design makes better sense.
I'd be interested in your feedback about the breakage incurred.
Thank you very much for the fix. Works fine for me now.
The breakage wasn't a big deal - I had a few places where I've used WindowInfo()
for child id resolving.
Testcode at
https://github.com/vengi-voxel/vengi/blob/6916070fd1a4f246e711eec7a23ea642b6e63d89/src/tools/voxedit/modules/voxedit-ui/tests/AssetPanelTest.cpp#L14
The first Run-all worked fine, the second lead to this crash
Maybe I'm doing something wrong here - but as the memory was allocated by testengine and also freed by testengine I thought it would make sense to report it.
https://github.com/vengi-voxel/vengi/issues/454