Index: src/d8.cc |
diff --git a/src/d8.cc b/src/d8.cc |
index 93b383d9acda6c77560a7cf459613263db59d29c..160ffa316edf90eac24a5fc62a040e979d82e134 100644 |
--- a/src/d8.cc |
+++ b/src/d8.cc |
@@ -968,6 +968,16 @@ void ShellThread::Run() { |
#endif // V8_SHARED |
+SourceGroup::~SourceGroup() { |
+ delete next_semaphore_; |
+ next_semaphore_ = NULL; |
+ delete done_semaphore_; |
+ done_semaphore_ = NULL; |
+ delete thread_; |
+ thread_ = NULL; |
+} |
+ |
+ |
void SourceGroup::ExitShell(int exit_code) { |
// Use _exit instead of exit to avoid races between isolate |
// threads and static destructors. |
@@ -1037,7 +1047,7 @@ i::Thread::Options SourceGroup::GetThreadOptions() { |
void SourceGroup::ExecuteInThread() { |
Isolate* isolate = Isolate::New(); |
do { |
- if (!next_semaphore_.is_empty()) next_semaphore_->Wait(); |
+ if (next_semaphore_ != NULL) next_semaphore_->Wait(); |
{ |
Isolate::Scope iscope(isolate); |
Locker lock(isolate); |
@@ -1049,15 +1059,15 @@ void SourceGroup::ExecuteInThread() { |
} |
context.Dispose(); |
} |
- if (!done_semaphore_.is_empty()) done_semaphore_->Signal(); |
+ if (done_semaphore_ != NULL) done_semaphore_->Signal(); |
} while (!Shell::options.last_run); |
isolate->Dispose(); |
} |
void SourceGroup::StartExecuteInThread() { |
- if (thread_.is_empty()) { |
- thread_ = i::SmartPointer<i::Thread>(new IsolateThread(this)); |
+ if (thread_ == NULL) { |
+ thread_ = new IsolateThread(this); |
thread_->Start(); |
} |
next_semaphore_->Signal(); |
@@ -1065,9 +1075,10 @@ void SourceGroup::StartExecuteInThread() { |
void SourceGroup::WaitForThread() { |
- if (thread_.is_empty()) return; |
+ if (thread_ == NULL) return; |
if (Shell::options.last_run) { |
thread_->Join(); |
+ thread_ = NULL; |
Vitaly Repeshko
2011/09/08 22:56:40
Ooops, didn't notice this edit. This looks wrong.
tfarina
2011/09/08 22:58:18
Double-free? It was here before the SmartPointer c
|
} else { |
done_semaphore_->Wait(); |
} |