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)
|
||||
return;
|
||||
if (fCursor)
|
||||
fCursor->Release();
|
||||
if (cursor)
|
||||
cursor->Acquire();
|
||||
ServerCursor* oldCursor = fCursor;
|
||||
fCursor = cursor;
|
||||
if (fCursor)
|
||||
fCursor->Acquire();
|
||||
if (oldCursor)
|
||||
oldCursor->Release();
|
||||
}
|
||||
ServerCursor* Cursor() const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user