@@ -24,7 +24,6 @@ static int netimgui_ConnectToApp(lua_State *L)
24
24
static int netimgui_ConnectFromApp (lua_State *L)
25
25
{
26
26
DM_LUA_STACK_CHECK (L, 0 );
27
- // imgui_NewFrame();
28
27
const char * client_name = luaL_checkstring (L, 1 );
29
28
NetImgui::ConnectFromApp (client_name);
30
29
return 0 ;
@@ -33,11 +32,17 @@ static int netimgui_ConnectFromApp(lua_State *L)
33
32
static int netimgui_Disconnect (lua_State *L)
34
33
{
35
34
DM_LUA_STACK_CHECK (L, 0 );
36
- // imgui_NewFrame();
37
35
NetImgui::Disconnect ();
38
36
return 0 ;
39
37
}
40
38
39
+ static int netimgui_Shutdown (lua_State *L)
40
+ {
41
+ DM_LUA_STACK_CHECK (L, 0 );
42
+ NetImgui::Shutdown ();
43
+ return 0 ;
44
+ }
45
+
41
46
static int netimgui_IsConnected (lua_State *L)
42
47
{
43
48
DM_LUA_STACK_CHECK (L, 1 );
@@ -55,6 +60,7 @@ static const luaL_reg Module_methods[] =
55
60
{" connect_to_app" , netimgui_ConnectToApp},
56
61
{" disconnect" , netimgui_Disconnect},
57
62
{" is_connected" , netimgui_IsConnected},
63
+ {" shutdown" , netimgui_Shutdown},
58
64
{0 , 0 }
59
65
};
60
66
@@ -91,7 +97,9 @@ dmExtension::Result AppFinalizeDefoldNetImGui(dmExtension::AppParams* params)
91
97
dmExtension::Result FinalizeDefoldNetImGui (dmExtension::Params* params)
92
98
{
93
99
dmLogInfo (" FinalizeDefoldNetImGui" );
94
- NetImgui::Shutdown ();
100
+ // Shutdown is now triggered from netimgui.script, to avoid a crash
101
+ // from a presumed race condition with imgui shutdown
102
+ // NetImgui::Shutdown();
95
103
return dmExtension::RESULT_OK;
96
104
}
97
105
0 commit comments