diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-09-07 06:44:38 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-09-07 06:44:38 +0300 |
commit | fec0a38e6a12c8674e54a29b0c3ae54fa78e86ff (patch) | |
tree | fa68e8d59ade869c1de33bce9eb60a8cd05fdbc8 /src/net/download.cpp | |
parent | ba0d8f949647aa4ced776438a1e1e9ebd77c4660 (diff) | |
download | manaverse-fec0a38e6a12c8674e54a29b0c3ae54fa78e86ff.tar.gz manaverse-fec0a38e6a12c8674e54a29b0c3ae54fa78e86ff.tar.bz2 manaverse-fec0a38e6a12c8674e54a29b0c3ae54fa78e86ff.tar.xz manaverse-fec0a38e6a12c8674e54a29b0c3ae54fa78e86ff.zip |
Fix possible thread structure memory leak on SDL2 if thread terminated before cleanup.
Diffstat (limited to 'src/net/download.cpp')
-rw-r--r-- | src/net/download.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/net/download.cpp b/src/net/download.cpp index 769a498b3..54aa8b217 100644 --- a/src/net/download.cpp +++ b/src/net/download.cpp @@ -110,9 +110,7 @@ Download::~Download() mHeaders = nullptr; } - int status; - if ((mThread != nullptr) && (SDL_GetThreadID(mThread) != 0u)) - SDL_WaitThread(mThread, &status); + SDL::WaitThread(mThread); mThread = nullptr; free(mError); } @@ -208,9 +206,7 @@ void Download::cancel() logger->log("Canceling download: %s", mUrl.c_str()); mOptions.cancel = 1u; - if ((mThread != nullptr) && (SDL_GetThreadID(mThread) != 0u)) - SDL_WaitThread(mThread, nullptr); - + SDL::WaitThread(mThread); mThread = nullptr; } |