# HG changeset patch # User Benjamin Golinvaux # Date 1589894895 -7200 # Node ID fb8c36073983b0b585d9a5793e985071156a56fa # Parent d0a3de66bb42ec4c33fb51eb49c20869ac78821b Fix problem where multiple init/exit were not possible when using GuiAdapter diff -r d0a3de66bb42 -r fb8c36073983 Deprecated/Applications/Generic/GuiAdapter.cpp --- a/Deprecated/Applications/Generic/GuiAdapter.cpp Tue May 19 13:24:16 2020 +0200 +++ b/Deprecated/Applications/Generic/GuiAdapter.cpp Tue May 19 15:28:15 2020 +0200 @@ -56,6 +56,8 @@ return os; } + int GuiAdapter::s_instanceCount = 0; + #if ORTHANC_ENABLE_WASM == 1 void GuiAdapter::Run(GuiAdapterRunFunc /*func*/, void* /*cookie*/) { @@ -1132,9 +1134,8 @@ OnSdlGenericEvent(sdlEvent); } + SDL_Delay(1); } - - SDL_Delay(1); } } #endif diff -r d0a3de66bb42 -r fb8c36073983 Deprecated/Applications/Generic/GuiAdapter.h --- a/Deprecated/Applications/Generic/GuiAdapter.h Tue May 19 13:24:16 2020 +0200 +++ b/Deprecated/Applications/Generic/GuiAdapter.h Tue May 19 15:28:15 2020 +0200 @@ -249,9 +249,13 @@ public: GuiAdapter() { - static int instanceCount = 0; - ORTHANC_ASSERT(instanceCount == 0); - instanceCount = 1; + ORTHANC_ASSERT(s_instanceCount == 0); + s_instanceCount = 1; + } + + ~GuiAdapter() + { + s_instanceCount -= 1; } /** @@ -371,5 +375,7 @@ deals with this) */ void ViewportsUpdateSize(); + + static int s_instanceCount; }; }