Implemented Oliver's suggested improvement to ServerCursorReference when
switching cursors. There was a race condition in case the objects was used by multiple threads, in which Cursor() could return an already destroyed object. Note: This doesn't fix a real bug or anything, the change is purely forward looking in case ServerCursorReference is ever used like that. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24862 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -105,11 +105,12 @@ public:
|
|||||||
{
|
{
|
||||||
if (fCursor == cursor)
|
if (fCursor == cursor)
|
||||||
return;
|
return;
|
||||||
if (fCursor)
|
if (cursor)
|
||||||
fCursor->Release();
|
cursor->Acquire();
|
||||||
|
ServerCursor* oldCursor = fCursor;
|
||||||
fCursor = cursor;
|
fCursor = cursor;
|
||||||
if (fCursor)
|
if (oldCursor)
|
||||||
fCursor->Acquire();
|
oldCursor->Release();
|
||||||
}
|
}
|
||||||
ServerCursor* Cursor() const
|
ServerCursor* Cursor() const
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user