VirtualBox

Changeset 35724 in vbox


Ignore:
Timestamp:
Jan 26, 2011 5:16:10 PM (14 years ago)
Author:
vboxsync
Message:

burn fix

Location:
trunk/include/VBox/com
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/com/defs.h

    r35722 r35724  
    273273#define COM_INTERFACE_ENTRY2(a,b)
    274274#define END_COM_MAP() NS_DECL_ISUPPORTS
     275#define COM_INTERFACE_ENTRY_AGGREGATE(a,b)
    275276
    276277#define HRESULT     nsresult
  • trunk/include/VBox/com/listeners.h

    r35722 r35724  
    4747
    4848template <class T, class TParam = void* >
    49 class ListenerImpl : 
     49class ListenerImpl :
    5050     public CComObjectRootEx<CComMultiThreadModel>,
    5151     VBOX_SCRIPTABLE_IMPL(IEventListener)
     
    5656    /* FTM stuff */
    5757    CComPtr <IUnknown>   m_pUnkMarshaler;
     58#else
     59    nsAutoRefCnt mRefCnt;
     60    NS_DECL_OWNINGTHREAD
    5861#endif
    5962
     
    6164    ListenerImpl()
    6265    {
    63     } 
     66    }
    6467
    6568    virtual ~ListenerImpl()
     
    6972    HRESULT init(T* aListener, TParam param)
    7073    {
    71        mListener = aListener; 
     74       mListener = aListener;
    7275       return mListener->init(param);
    7376    }
     
    9497       return CoCreateFreeThreadedMarshaler(this, &m_pUnkMarshaler.p);
    9598#else
    96        mRefCnt = 1;
    9799       return S_OK;
    98100#endif
     
    112114    }
    113115
    114     /* On Windows QI implemented by COM_MAP() */
    115 #ifndef RT_OS_WINDOWS
    116     NS_IMPL_QUERY_INTERFACE1_INLINE(IEventListener)
    117 #endif
    118  
    119116    DECLARE_NOT_AGGREGATABLE(ListenerImpl)
    120117
    121118    DECLARE_PROTECT_FINAL_CONSTRUCT()
    122119
     120#ifdef RT_OS_WINDOWS
    123121    BEGIN_COM_MAP(ListenerImpl)
    124         COM_INTERFACE_ENTRY(IEventListener) 
     122        COM_INTERFACE_ENTRY(IEventListener)
    125123        COM_INTERFACE_ENTRY2(IDispatch, IEventListener)
    126124        COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
    127125    END_COM_MAP()
     126#else
     127    NS_IMETHOD_(nsrefcnt) AddRef(void)
     128    {
     129        NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt");
     130        nsrefcnt count;
     131        count = PR_AtomicIncrement((PRInt32*)&mRefCnt);
     132        NS_LOG_ADDREF(this, count, "ListenerImpl", sizeof(*this));
     133        return count;
     134    }
     135
     136    NS_IMETHOD_(nsrefcnt) Release(void)
     137    {
     138        nsrefcnt count;
     139        NS_PRECONDITION(0 != mRefCnt, "dup release");
     140        count = PR_AtomicDecrement((PRInt32 *)&mRefCnt);
     141        NS_LOG_RELEASE(this, count, "ListenerImpl");
     142        if (0 == count) {
     143            mRefCnt = 1; /* stabilize */
     144            /* enable this to find non-threadsafe destructors: */
     145            /* NS_ASSERT_OWNINGTHREAD(_class); */
     146            NS_DELETEXPCOM(this);
     147            return 0;
     148        }
     149        return count;
     150    }
     151
     152    NS_IMPL_QUERY_INTERFACE1_INLINE(IEventListener)
     153#endif
    128154
    129155
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette