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:
@@ -188,6 +188,7 @@ PrivateConditionVariableEntry::_Remove()
|
|||||||
if (this == fVariable->fEntries) {
|
if (this == fVariable->fEntries) {
|
||||||
fVariable->fEntries = fVariableNext;
|
fVariable->fEntries = fVariableNext;
|
||||||
fVariableNext = NULL;
|
fVariableNext = NULL;
|
||||||
|
fVariable = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,6 +198,7 @@ PrivateConditionVariableEntry::_Remove()
|
|||||||
if (this == entry->fVariableNext) {
|
if (this == entry->fVariableNext) {
|
||||||
entry->fVariableNext = fVariableNext;
|
entry->fVariableNext = fVariableNext;
|
||||||
fVariableNext = NULL;
|
fVariableNext = NULL;
|
||||||
|
fVariable = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,14 +337,14 @@ PrivateConditionVariable::_Notify(bool all, bool threadsLocked, status_t result)
|
|||||||
|
|
||||||
while (PrivateConditionVariableEntry* entry = fEntries) {
|
while (PrivateConditionVariableEntry* entry = fEntries) {
|
||||||
fEntries = entry->fVariableNext;
|
fEntries = entry->fVariableNext;
|
||||||
|
entry->fVariableNext = NULL;
|
||||||
|
entry->fVariable = NULL;
|
||||||
|
|
||||||
struct thread* thread = entry->fThread;
|
struct thread* thread = entry->fThread;
|
||||||
|
|
||||||
if (thread->condition_variable_entry != NULL)
|
if (thread->condition_variable_entry != NULL)
|
||||||
thread->condition_variable_entry->fResult = result;
|
thread->condition_variable_entry->fResult = result;
|
||||||
|
|
||||||
entry->fVariableNext = NULL;
|
|
||||||
entry->fVariable = NULL;
|
|
||||||
|
|
||||||
// remove other entries of this thread from their respective variables
|
// remove other entries of this thread from their respective variables
|
||||||
PrivateConditionVariableEntry* otherEntry = entry->fThreadPrevious;
|
PrivateConditionVariableEntry* otherEntry = entry->fThreadPrevious;
|
||||||
while (otherEntry) {
|
while (otherEntry) {
|
||||||
|
|||||||
Reference in New Issue
Block a user