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:
Stephan Bergmann
2013-02-16 12:22:21 +01:00
parent 15003612ae
commit c240c73c34

View File

@@ -1103,8 +1103,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( release )( IMPL_RTL_STRINGDATA* pThis )
}
#endif
if ( pThis->refCount == 1 ||
!osl_atomic_decrement( &(pThis->refCount) ) )
if ( !osl_atomic_decrement( &(pThis->refCount) ) )
{
RTL_LOG_STRING_DELETE( pThis );
rtl_freeMemory( pThis );