summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-09-07 06:44:38 +0300
committerAndrei Karas <akaras@inbox.ru>2017-09-07 06:44:38 +0300
commitfec0a38e6a12c8674e54a29b0c3ae54fa78e86ff (patch)
treefa68e8d59ade869c1de33bce9eb60a8cd05fdbc8 /src/gui
parentba0d8f949647aa4ced776438a1e1e9ebd77c4660 (diff)
downloadplus-fec0a38e6a12c8674e54a29b0c3ae54fa78e86ff.tar.gz
plus-fec0a38e6a12c8674e54a29b0c3ae54fa78e86ff.tar.bz2
plus-fec0a38e6a12c8674e54a29b0c3ae54fa78e86ff.tar.xz
plus-fec0a38e6a12c8674e54a29b0c3ae54fa78e86ff.zip
Fix possible thread structure memory leak on SDL2 if thread terminated before cleanup.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/windows/whoisonline.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp
index 1401ec280..35d930c4c 100644
--- a/src/gui/windows/whoisonline.cpp
+++ b/src/gui/windows/whoisonline.cpp
@@ -175,9 +175,8 @@ WhoIsOnline::~WhoIsOnline()
config.removeListeners(this);
CHECKLISTENERS
- if ((mThread != nullptr) && (SDL_GetThreadID(mThread) != 0u))
- SDL_WaitThread(mThread, nullptr);
-
+ SDL::WaitThread(mThread);
+ mThread = nullptr;
free(mMemoryBuffer);
mMemoryBuffer = nullptr;
@@ -628,9 +627,8 @@ void WhoIsOnline::download()
else if (mWebList)
{
mDownloadComplete = true;
- if (mThread != nullptr && SDL_GetThreadID(mThread) != 0U)
- SDL_WaitThread(mThread, nullptr);
-
+ SDL::WaitThread(mThread);
+ mThread = nullptr;
mDownloadComplete = false;
mThread = SDL::createThread(&WhoIsOnline::downloadThread,
"whoisonline", this);
@@ -729,11 +727,8 @@ void WhoIsOnline::action(const ActionEvent &event)
mUpdateButton->setEnabled(false);
// TRANSLATORS: who is online window name
setCaption(_("Who Is Online - Update"));
- if (mThread != nullptr && SDL_GetThreadID(mThread) != 0U)
- {
- SDL_WaitThread(mThread, nullptr);
- mThread = nullptr;
- }
+ SDL::WaitThread(mThread);
+ mThread = nullptr;
mDownloadComplete = true;
}
}