Преглед изворни кода

Reapply idempotent atexit patch;

bjorn пре 4 година
родитељ
комит
d60277cc2e
1 измењених фајлова са 6 додато и 1 уклоњено
  1. 6 1
      enet.c

+ 6 - 1
enet.c

@@ -772,9 +772,14 @@ static const struct luaL_Reg enet_event_funcs [] = {
 	{NULL, NULL}
 };
 
+static int initialized = 0;
+
 int luaopen_enet(lua_State *l) {
 	enet_initialize();
-	atexit(enet_deinitialize);
+  if (!initialized) {
+    initialized = 1;
+    atexit(enet_deinitialize);
+  }
 
 	// create metatables
 	luaL_newmetatable(l, "enet_host");