diff --git a/src/common/CException.cpp b/src/common/CException.cpp index d10aa1e22..33a3971e1 100644 --- a/src/common/CException.cpp +++ b/src/common/CException.cpp @@ -9,7 +9,6 @@ #include "../game/CServer.h" #include "../game/CWorld.h" -#ifdef _DEBUG #include int IsDebuggerPresent(void) { @@ -35,12 +34,10 @@ int IsDebuggerPresent(void) return debugger_present; } -#endif // _DEBUG #endif // !_WIN32 -#ifdef _DEBUG void NotifyDebugger() { if (IsDebuggerPresent()) @@ -58,7 +55,6 @@ void NotifyDebugger() } } -#endif // _DEBUG #ifdef _WIN32 @@ -342,12 +338,20 @@ void _cdecl Signal_Children(int sig = 0) #ifndef _WIN32 void SetUnixSignals( bool fSet ) // Signal handlers are installed only in secure mode { -#if defined(_SANITIZERS) -# define __SANS true + +#ifdef _SANITIZERS + const bool fSan = true; #else -# define __SANS false + const bool fSan = false; #endif - if (!IsDebuggerPresent() || !__SANS) + +#ifdef _DEBUG + const bool fDebugger = IsDebuggerPresent(); +#else + const bool fDebugger = false; +#endif + + if (!fDebugger && !fSan) { signal( SIGHUP, fSet ? &Signal_Hangup : SIG_DFL ); signal( SIGTERM, fSet ? &Signal_Terminate : SIG_DFL ); @@ -361,6 +365,6 @@ void SetUnixSignals( bool fSet ) // Signal handlers are installed only in sec signal( SIGPIPE, fSet ? SIG_IGN : SIG_DFL ); signal( SIGCHLD, fSet ? &Signal_Children : SIG_DFL ); -#undef __SANS + } #endif diff --git a/src/common/CException.h b/src/common/CException.h index 789d9f7aa..83456ba54 100644 --- a/src/common/CException.h +++ b/src/common/CException.h @@ -22,14 +22,10 @@ void SetExceptionTranslator(); #ifndef _WIN32 void SetUnixSignals( bool ); - #ifdef _DEBUG - int IsDebuggerPresent(); // Windows already has this function - #endif + int IsDebuggerPresent(); // Windows already has this function #endif -#ifdef _DEBUG - void NotifyDebugger(); -#endif +void NotifyDebugger(); // ------------------------------------------------------------------- // ------------------------------------------------------------------- diff --git a/src/game/CObjBase.cpp b/src/game/CObjBase.cpp index c4e2948ef..a6d31dbd0 100644 --- a/src/game/CObjBase.cpp +++ b/src/game/CObjBase.cpp @@ -203,7 +203,7 @@ void CObjBase::DeletePrepare() const SERVMODE_TYPE servMode = g_Serv.GetServerMode(); const bool fDestroyingWorld = (servMode != SERVMODE_Exiting && servMode != SERVMODE_Loading); - if (fDestroyingWorld) + if (!fDestroyingWorld) { RemoveFromView(); }