From e8143de01bff31f9e153949d7ab5b0df82629541 Mon Sep 17 00:00:00 2001 From: archshift Date: Thu, 19 Jun 2014 01:49:56 -0700 Subject: Nullify deleted pointers. --- src/OSSupport/Event.cpp | 1 + src/OSSupport/SocketThreads.cpp | 1 + src/OSSupport/Thread.cpp | 2 ++ 3 files changed, 4 insertions(+) (limited to 'src/OSSupport') diff --git a/src/OSSupport/Event.cpp b/src/OSSupport/Event.cpp index 649a0a3cf..6b8fccde2 100644 --- a/src/OSSupport/Event.cpp +++ b/src/OSSupport/Event.cpp @@ -71,6 +71,7 @@ cEvent::~cEvent() { sem_destroy(m_Event); delete m_Event; + m_Event = NULL; } #endif } diff --git a/src/OSSupport/SocketThreads.cpp b/src/OSSupport/SocketThreads.cpp index 0ab5b6298..ca8b8438d 100644 --- a/src/OSSupport/SocketThreads.cpp +++ b/src/OSSupport/SocketThreads.cpp @@ -61,6 +61,7 @@ bool cSocketThreads::AddClient(const cSocket & a_Socket, cCallback * a_Client) // There was an error launching the thread (but it was already logged along with the reason) LOGERROR("A new cSocketThread failed to start"); delete Thread; + Thread = NULL; return false; } Thread->AddClient(a_Socket, a_Client); diff --git a/src/OSSupport/Thread.cpp b/src/OSSupport/Thread.cpp index 7a10ef8d2..535784613 100644 --- a/src/OSSupport/Thread.cpp +++ b/src/OSSupport/Thread.cpp @@ -66,11 +66,13 @@ cThread::cThread( ThreadFunc a_ThreadFunction, void* a_Param, const char* a_Thre cThread::~cThread() { delete m_Event; + m_Event = NULL; if( m_StopEvent ) { m_StopEvent->Wait(); delete m_StopEvent; + m_StopEvent = NULL; } } -- cgit v1.2.3 From a5a0533d793a64b76a84f23d4ca1754571ee0b40 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 30 Jun 2014 21:41:14 +0200 Subject: Fixed cFile compilation under MinGW. --- src/OSSupport/File.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/OSSupport') diff --git a/src/OSSupport/File.cpp b/src/OSSupport/File.cpp index 8c24fa541..addf8f928 100644 --- a/src/OSSupport/File.cpp +++ b/src/OSSupport/File.cpp @@ -7,6 +7,9 @@ #include "File.h" #include +#ifdef _WIN32 + #include // for _SH_DENYWRITE +#endif // _WIN32 -- cgit v1.2.3 From 7177806d31a5c6df52a8439bee2f4d150fa0eb47 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 30 Jun 2014 22:37:26 +0200 Subject: Fixed printf formats for Win builds --- src/OSSupport/Event.cpp | 6 +++--- src/OSSupport/IsThread.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/OSSupport') diff --git a/src/OSSupport/Event.cpp b/src/OSSupport/Event.cpp index 6b8fccde2..72bce4c3c 100644 --- a/src/OSSupport/Event.cpp +++ b/src/OSSupport/Event.cpp @@ -18,7 +18,7 @@ cEvent::cEvent(void) m_Event = CreateEvent(NULL, FALSE, FALSE, NULL); if (m_Event == NULL) { - LOGERROR("cEvent: cannot create event, GLE = %d. Aborting server.", GetLastError()); + LOGERROR("cEvent: cannot create event, GLE = %u. Aborting server.", (unsigned)GetLastError()); abort(); } #else // *nix @@ -86,7 +86,7 @@ void cEvent::Wait(void) DWORD res = WaitForSingleObject(m_Event, INFINITE); if (res != WAIT_OBJECT_0) { - LOGWARN("cEvent: waiting for the event failed: %d, GLE = %d. Continuing, but server may be unstable.", res, GetLastError()); + LOGWARN("cEvent: waiting for the event failed: %u, GLE = %u. Continuing, but server may be unstable.", (unsigned)res, (unsigned)GetLastError()); } #else int res = sem_wait(m_Event); @@ -107,7 +107,7 @@ void cEvent::Set(void) #ifdef _WIN32 if (!SetEvent(m_Event)) { - LOGWARN("cEvent: Could not set cEvent: GLE = %d", GetLastError()); + LOGWARN("cEvent: Could not set cEvent: GLE = %u", (unsigned)GetLastError()); } #else int res = sem_post(m_Event); diff --git a/src/OSSupport/IsThread.cpp b/src/OSSupport/IsThread.cpp index 67f336c97..1a436623a 100644 --- a/src/OSSupport/IsThread.cpp +++ b/src/OSSupport/IsThread.cpp @@ -90,7 +90,7 @@ bool cIsThread::Start(void) m_Handle = CreateThread(NULL, 0, thrExecute, this, CREATE_SUSPENDED, &m_ThreadID); if (m_Handle == NULL) { - LOGERROR("ERROR: Could not create thread \"%s\", GLE = %d!", m_ThreadName.c_str(), GetLastError()); + LOGERROR("ERROR: Could not create thread \"%s\", GLE = %u!", m_ThreadName.c_str(), (unsigned)GetLastError()); return false; } ResumeThread(m_Handle); -- cgit v1.2.3