INTEGRATION: CWS dbo510 (1.9.14); FILE MERGED
2005/11/21 15:33:46 dbo 1.9.14.1: #i58248# fixing Weak[Agg]ComponentImplHelperBase::release(), documenting OWeakObject::release()
This commit is contained in:
parent
198646715b
commit
b88d12c01b
@ -4,9 +4,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: weak.cxx,v $
|
* $RCSfile: weak.cxx,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.9 $
|
* $Revision: 1.10 $
|
||||||
*
|
*
|
||||||
* last change: $Author: rt $ $Date: 2005-09-08 09:31:08 $
|
* last change: $Author: rt $ $Date: 2006-03-06 10:11:16 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to
|
* The Contents of this file are made available subject to
|
||||||
* the terms of GNU Lesser General Public License Version 2.1.
|
* the terms of GNU Lesser General Public License Version 2.1.
|
||||||
@ -49,33 +49,6 @@ using namespace com::sun::star::uno;
|
|||||||
namespace cppu
|
namespace cppu
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
The mutex to synchronize the the queryAdapted call throug the connection point
|
|
||||||
with the release call at the weak object.
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
struct WeakMutexStatic
|
|
||||||
{
|
|
||||||
Mutex aMutex;
|
|
||||||
sal_Bool bDestructed;
|
|
||||||
|
|
||||||
WeakMutexStatic()
|
|
||||||
: bDestructed( sal_False )
|
|
||||||
{}
|
|
||||||
~WeakMutexStatic()
|
|
||||||
{ bDestructed = sal_True; }
|
|
||||||
};
|
|
||||||
|
|
||||||
inline static Mutex & getWeakMutex() throw()
|
|
||||||
{
|
|
||||||
static WeakMutexStatic s_wmstatic;
|
|
||||||
if (s_wmstatic.bDestructed)
|
|
||||||
return *Mutex::getGlobalMutex();
|
|
||||||
else
|
|
||||||
return s_wmstatic.aMutex;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// due to static Reflection destruction from usr, ther must be a mutex leak (#73272#)
|
// due to static Reflection destruction from usr, ther must be a mutex leak (#73272#)
|
||||||
inline static Mutex & getWeakMutex() SAL_THROW( () )
|
inline static Mutex & getWeakMutex() SAL_THROW( () )
|
||||||
{
|
{
|
||||||
@ -222,15 +195,24 @@ void SAL_CALL OWeakObject::acquire() throw()
|
|||||||
// XInterface
|
// XInterface
|
||||||
void SAL_CALL OWeakObject::release() throw()
|
void SAL_CALL OWeakObject::release() throw()
|
||||||
{
|
{
|
||||||
if (osl_decrementInterlockedCount( &m_refCount ) == 0)
|
if (osl_decrementInterlockedCount( &m_refCount ) == 0) {
|
||||||
{
|
// notify/clear all weak-refs before object's dtor is executed
|
||||||
if (m_pWeakConnectionPoint)
|
// (which may check weak-refs to this object):
|
||||||
{
|
if (m_pWeakConnectionPoint != 0) {
|
||||||
OWeakConnectionPoint * p = m_pWeakConnectionPoint;
|
OWeakConnectionPoint * const p = m_pWeakConnectionPoint;
|
||||||
m_pWeakConnectionPoint = 0;
|
m_pWeakConnectionPoint = 0;
|
||||||
|
try {
|
||||||
p->dispose();
|
p->dispose();
|
||||||
|
}
|
||||||
|
catch (RuntimeException const& exc) {
|
||||||
|
OSL_ENSURE(
|
||||||
|
false, OUStringToOString(
|
||||||
|
exc.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
|
||||||
|
static_cast<void>(exc);
|
||||||
|
}
|
||||||
p->release();
|
p->release();
|
||||||
}
|
}
|
||||||
|
// destroy object:
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user