ejoy / ant

Ant game engine
MIT License
3.71k stars 372 forks source link

发现一个ImGui.GetIO()的崩溃 #128

Closed constly closed 1 month ago

constly commented 2 months ago

我最近在做切换场景的功能,然后遇到一个imgui的宕机。 bug_07

我研究了下了,应该是ant.imgui里面mian.lua导致的

function ImGuiAnt.DispatchEvent(e)
    ImGuiIO = ImGui.GetIO()
    local func = ImGuiEvent[e.type]
    return func and func(e)
end

调用ImGui.GetIO时 可能得先判断下时机。

因为我在新场景加载了一个比较大的字体,loading时间比较久,在这个期间晃动鼠标,必崩。

actboy168 commented 2 months ago

看起来是ImGui没初始化,但不知道你是如何在ImGui未初始化的情况下触发到DispatchEvent的

constly commented 1 month ago

操作是这样:

  1. 进入场景后,渲染一个imgui界面
  2. 点击按钮并 执行 window.reboot
  3. 在加载期间 晃动鼠标,游戏崩溃

bug