Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/Thread.cpp

Issue 29361582: Issue 4613 - fix leak of Thread (Closed)
Patch Set: Created Nov. 3, 2016, 10:58 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/Thread.cpp
diff --git a/src/Thread.cpp b/src/Thread.cpp
index 277dd386ce87c614fb6b771dff09ada8243b3476..91bfe61fdf727b428f63b9d413bc9bef130a6d39 100644
--- a/src/Thread.cpp
+++ b/src/Thread.cpp
@@ -23,14 +23,6 @@
using namespace AdblockPlus;
-namespace
-{
- void CallRun(Thread* thread)
- {
- thread->Run();
- }
-}
-
void AdblockPlus::Sleep(const int millis)
{
#ifdef WIN32
@@ -86,6 +78,11 @@ Lock::~Lock()
mutex.Unlock();
}
+Thread::Thread(bool deleteSelfOnFinish)
+ : m_deleteSelfOnFinish(deleteSelfOnFinish)
Oleksandr 2016/11/07 10:31:31 Do we have a case where we would not want to delet
sergei 2016/11/07 13:04:12 Yes, we have it already in tests, in those cases T
+{
+}
+
Thread::~Thread()
{
}
@@ -107,3 +104,10 @@ void Thread::Join()
pthread_join(nativeThread, 0);
#endif
}
+
+void Thread::CallRun(Thread* thread)
+{
+ thread->Run();
+ if (thread->m_deleteSelfOnFinish)
sergei 2016/11/07 13:04:12 BTW, this code is pretty dangerous because it's ve
+ delete thread;
+}
« src/FileSystemJsObject.cpp ('K') | « src/Thread.h ('k') | src/WebRequestJsObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld