Remove mis-optimization
Assume thread t1 creates OUString s, then spawns thread t2, then t2 acquires s, then t2 signals via a channel that does not necessarily involve memory synchronization (e.g., writes a byte into a pipe which t1 reads), then t1 releases s and can still see a refCount of 1 instead of 2. Change-Id: I31047a1a6cc8fccc401a87849f5c3cee3642d803
This commit is contained in:
@@ -1103,8 +1103,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( release )( IMPL_RTL_STRINGDATA* pThis )
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( pThis->refCount == 1 ||
|
if ( !osl_atomic_decrement( &(pThis->refCount) ) )
|
||||||
!osl_atomic_decrement( &(pThis->refCount) ) )
|
|
||||||
{
|
{
|
||||||
RTL_LOG_STRING_DELETE( pThis );
|
RTL_LOG_STRING_DELETE( pThis );
|
||||||
rtl_freeMemory( pThis );
|
rtl_freeMemory( pThis );
|
||||||
|
Reference in New Issue
Block a user