Skip to content

Commit caba681

Browse files
committed
fix: Stopping threads in GamemodeExit and not in Unload, since otherwise Unload would never be called
1 parent 88eba4b commit caba681

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/bindings/callbacks.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ PLUGIN_EXPORT bool PLUGIN_CALL OnGameModeInit() {
2121
return PySAMP::callback("OnGameModeInit", NULL);
2222
}
2323

24-
PLUGIN_EXPORT bool PLUGIN_CALL OnGameModeExit() {
25-
return PySAMP::callback("OnGameModeExit", NULL);
26-
}
2724

2825
PLUGIN_EXPORT bool PLUGIN_CALL OnPlayerConnect(int playerid) {
2926
return PySAMP::callback("OnPlayerConnect", Py_BuildValue("(i)", playerid));

src/main.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ PLUGIN_EXPORT bool PLUGIN_CALL Load(void **ppData)
4545

4646
PLUGIN_EXPORT void PLUGIN_CALL Unload()
4747
{
48-
if(threadingInitialized)
49-
{
50-
PySAMP::callback("OnThreadingStopSignal", NULL);
51-
threading.join();
52-
}
5348
sampgdk::Unload();
5449
}
5550

@@ -58,3 +53,13 @@ PLUGIN_EXPORT void PLUGIN_CALL ProcessTick()
5853
sampgdk::ProcessTick();
5954
PySAMP::callback("OnProcessTick", NULL);
6055
}
56+
57+
58+
PLUGIN_EXPORT bool PLUGIN_CALL OnGameModeExit() {
59+
if(threadingInitialized)
60+
{
61+
PySAMP::callback("OnThreadingStopSignal", NULL);
62+
threading.join();
63+
}
64+
return PySAMP::callback("OnGameModeExit", NULL);
65+
}

0 commit comments

Comments
 (0)