From 63fa790e9b62cf0863a530d305a57d077ace72d8 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Tue, 28 Aug 2007 03:34:06 +0000 Subject: [PATCH] fVariable was not correctly unset when the condition variable entry was removed from the variable, which could lead to crashes under certain cicrumstances. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22090 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/condition_variable.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/system/kernel/condition_variable.cpp b/src/system/kernel/condition_variable.cpp index 831e7bed1e..43be0e2e95 100644 --- a/src/system/kernel/condition_variable.cpp +++ b/src/system/kernel/condition_variable.cpp @@ -188,6 +188,7 @@ PrivateConditionVariableEntry::_Remove() if (this == fVariable->fEntries) { fVariable->fEntries = fVariableNext; fVariableNext = NULL; + fVariable = NULL; return; } @@ -197,6 +198,7 @@ PrivateConditionVariableEntry::_Remove() if (this == entry->fVariableNext) { entry->fVariableNext = fVariableNext; fVariableNext = NULL; + fVariable = NULL; return; } @@ -335,14 +337,14 @@ PrivateConditionVariable::_Notify(bool all, bool threadsLocked, status_t result) while (PrivateConditionVariableEntry* entry = fEntries) { fEntries = entry->fVariableNext; + entry->fVariableNext = NULL; + entry->fVariable = NULL; + struct thread* thread = entry->fThread; if (thread->condition_variable_entry != NULL) thread->condition_variable_entry->fResult = result; - entry->fVariableNext = NULL; - entry->fVariable = NULL; - // remove other entries of this thread from their respective variables PrivateConditionVariableEntry* otherEntry = entry->fThreadPrevious; while (otherEntry) {