Mercurial > hg > orthanc-stone
changeset 1436:fb8c36073983
Fix problem where multiple init/exit were not possible when using GuiAdapter
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Tue, 19 May 2020 15:28:15 +0200 |
parents | d0a3de66bb42 |
children | 297e57d3508c |
files | Deprecated/Applications/Generic/GuiAdapter.cpp Deprecated/Applications/Generic/GuiAdapter.h |
diffstat | 2 files changed, 12 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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; }; }