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
This commit is contained in:
Ingo Weinhold 2007-08-28 03:34:06 +00:00
parent a7ba350ff2
commit 63fa790e9b

View File

@ -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) {