vengi-voxel / vengi

free and open source voxel art tools - editor, thumbnailer and format converter
http://vengi-voxel.github.io/vengi/
Other
1.05k stars 87 forks source link

VOXEDIT: segfault in unittest #453

Closed mgerhardy closed 2 months ago

mgerhardy commented 2 months ago

scene graph test related - execute in this order:

Process 33566 launched: '/Users/gerhardym/dev/oss/vengi/build/voxedit/vengi-voxedit.app/Contents/MacOS/vengi-voxedit' (arm64)
(lldb) bt
* thread #16, name = 'Main Dear ImGui Test Thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x1418)
  * frame #0: 0x00000001dc1a1e74 libGL.dylib`glBindBuffer + 16
    frame #1: 0x0000000100403c10 vengi-voxedit`video::bindBuffer(type=ArrayBuffer, handle=16413) at GLRenderer.cpp:643:2
    frame #2: 0x0000000100406180 vengi-voxedit`video::bufferData(handle=16413, type=ArrayBuffer, mode=Static, data=0x0000000144a0e010, size=1248) at GLRenderer.cpp:1053:24
    frame #3: 0x00000001003dc87c vengi-voxedit`video::Buffer::update(this=0x000000014828b5a8, idx=0, data=0x0000000144a0e010, size=1248, orphaning=false) at Buffer.cpp:190:4
    frame #4: 0x00000001003d7798 vengi-voxedit`render::ShapeRenderer::update(this=0x000000014828b5a0, meshIndex=0, shapeBuilder=0x000000014828b4a0) at ShapeRenderer.cpp:144:2
    frame #5: 0x00000001003d71ec vengi-voxedit`render::ShapeRenderer::createOrUpdate(this=0x000000014828b5a0, meshIndex=0x000000014828c268, shapeBuilder=0x000000014828b4a0) at ShapeRenderer.cpp:62:3
    frame #6: 0x00000001003d5b50 vengi-voxedit`render::GridRenderer::update(this=0x000000014828b4a0, aabb=0x00000001705a06b8) at GridRenderer.cpp:53:17
    frame #7: 0x00000001001bae08 vengi-voxedit`voxedit::SceneRenderer::updateGridRegion(this=0x00000001481c8000, region=0x0000600003c30120) at SceneRenderer.cpp:75:17
    frame #8: 0x00000001000c4c74 vengi-voxedit`voxedit::SceneManager::updateGridRenderer(this=0x0000000148708000, region=0x0000600003c30120) at SceneManager.cpp:1363:18
    frame #9: 0x00000001000c4194 vengi-voxedit`voxedit::SceneManager::nodeActivate(this=0x0000000148708000, nodeId=1) at SceneManager.cpp:3337:2
    frame #10: 0x00000001000c3d68 vengi-voxedit`voxedit::SceneManager::resetSceneState(this=0x0000000148708000) at SceneManager.cpp:1247:2
    frame #11: 0x00000001000c4f84 vengi-voxedit`voxedit::SceneManager::newScene(this=0x0000000148708000, force=true, name=0x00000001705a1078, v=0x0000600003c30120) at SceneManager.cpp:1476:2
    frame #12: 0x00000001000c49cc vengi-voxedit`voxedit::SceneManager::newScene(this=0x0000000148708000, force=true, name=0x00000001705a1078, region=0x00000001705a0fd0) at SceneManager.cpp:1486:9
    frame #13: 0x000000010009f064 vengi-voxedit`voxedit::SceneGraphPanel::registerUITests(ImGuiTestEngine*, char const*)::$_0::operator()(this=0x00006000027295e8, ctx=0x00000001705a28f8) const at SceneGraphPanelTest.cpp:14:3
    frame #14: 0x000000010009ef5c vengi-voxedit`decltype(std::declval<voxedit::SceneGraphPanel::registerUITests(ImGuiTestEngine*, char const*)::$_0&>()(std::declval<ImGuiTestContext*>())) std::__1::__invoke[abi:v160006]<voxedit::SceneGraphPanel::registerUITests(ImGuiTestEngine*, char const*)::$_0&, ImGuiTestContext*>(__f=0x00006000027295e8, __args=0x00000001705a1190) at invoke.h:394:23
    frame #15: 0x000000010009ef08 vengi-voxedit`void std::__1::__invoke_void_return_wrapper<void, true>::__call<voxedit::SceneGraphPanel::registerUITests(ImGuiTestEngine*, char const*)::$_0&, ImGuiTestContext*>(__args=0x00006000027295e8, __args=0x00000001705a1190) at invoke.h:487:9
    frame #16: 0x000000010009eedc vengi-voxedit`std::__1::__function::__alloc_func<voxedit::SceneGraphPanel::registerUITests(ImGuiTestEngine*, char const*)::$_0, std::__1::allocator<voxedit::SceneGraphPanel::registerUITests(ImGuiTestEngine*, char const*)::$_0>, void (ImGuiTestContext*)>::operator()[abi:v160006](this=0x00006000027295e8, __arg=0x00000001705a1190) at function.h:185:16
    frame #17: 0x000000010009dd3c vengi-voxedit`std::__1::__function::__func<voxedit::SceneGraphPanel::registerUITests(ImGuiTestEngine*, char const*)::$_0, std::__1::allocator<voxedit::SceneGraphPanel::registerUITests(ImGuiTestEngine*, char const*)::$_0>, void (ImGuiTestContext*)>::operator()(this=0x00006000027295e0, __arg=0x00000001705a1190) at function.h:356:12
    frame #18: 0x00000001003c00a8 vengi-voxedit`std::__1::__function::__value_func<void (ImGuiTestContext*)>::operator()[abi:v160006](this=0x00006000027295e0, __args=0x00000001705a1190) const at function.h:510:16
    frame #19: 0x00000001003b8418 vengi-voxedit`std::__1::function<void (ImGuiTestContext*)>::operator()(this=0x00006000027295e0, __arg=0x00000001705a28f8) const at function.h:1156:12
    frame #20: 0x00000001003b754c vengi-voxedit`ImGuiTestEngine_RunTest(engine=0x00000001248ae200, parent_ctx=0x0000000000000000, test=0x0000600002729590, run_flags=16) at imgui_te_engine.cpp:1625:13
    frame #21: 0x00000001003becbc vengi-voxedit`ImGuiTestEngine_ProcessTestQueue(engine=0x00000001248ae200) at imgui_te_engine.cpp:1092:9
    frame #22: 0x00000001003b4530 vengi-voxedit`ImGuiTestEngine_TestQueueCoroutineMain(engine_opaque=0x00000001248ae200) at imgui_te_engine.cpp:909:9
    frame #23: 0x00000001003b1d88 vengi-voxedit`CoroutineThreadMain(data=0x000060000233ad80, func=(vengi-voxedit`ImGuiTestEngine_TestQueueCoroutineMain(void*) at imgui_te_engine.cpp:905), ctx=0x00000001248ae200) at imgui_te_coroutine.cpp:57:5
    frame #24: 0x00000001003b2a38 vengi-voxedit`decltype(std::declval<void (*)(Coroutine_ImplStdThreadData*, void (*)(void*), void*)>()(std::declval<Coroutine_ImplStdThreadData*>(), std::declval<void (*)(void*)>(), std::declval<void*>())) std::__1::__invoke[abi:v160006]<void (*)(Coroutine_ImplStdThreadData*, void (*)(void*), void*), Coroutine_ImplStdThreadData*, void (*)(void*), void*>(__f=0x00006000016e70c8, __args=0x00006000016e70d0, __args=0x00006000016e70d8, __args=0x00006000016e70e0) at invoke.h:394:23
    frame #25: 0x00000001003b29ac vengi-voxedit`void std::__1::__thread_execute[abi:v160006]<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void (*)(Coroutine_ImplStdThreadData*, void (*)(void*), void*), Coroutine_ImplStdThreadData*, void (*)(void*), void*, 2ul, 3ul, 4ul>(__t=size=5, (null)=__tuple_indices<2UL, 3UL, 4UL> @ 0x00000001705a2f7f) at thread:288:5
    frame #26: 0x00000001003b2204 vengi-voxedit`void* std::__1::__thread_proxy[abi:v160006]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void (*)(Coroutine_ImplStdThreadData*, void (*)(void*), void*), Coroutine_ImplStdThreadData*, void (*)(void*), void*>>(__vp=0x00006000016e70c0) at thread:299:5
    frame #27: 0x00000001859b2f94 libsystem_pthread.dylib`_pthread_start + 136
(lldb) f 6
frame #6: 0x00000001003d5b50 vengi-voxedit`render::GridRenderer::update(this=0x000000014828b4a0, aabb=0x00000001705a06b8) at GridRenderer.cpp:53:17
   50       _aabb = aabb;
   51       _shapeBuilder.clear();
   52       _shapeBuilder.aabb(aabb, false, 1.0f, thickness);
-> 53       _shapeRenderer.createOrUpdate(_aabbMeshIndex, _shapeBuilder);
   54   
   55       _shapeBuilder.clear();
   56       _shapeBuilder.aabbGridXY(aabb, false, (float)_resolution, thickness);
mgerhardy commented 2 months ago

looks like this is accessing opengl states from a different thread...