[Common-cvs] log/logobserverfile hxtlogobserver.cpp,1.24,1.24.4.1
ehyche at helixcommunity.org ehyche at helixcommunity.orgUpdate of /cvsroot/common/log/logobserverfile
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv16265
Modified Files:
Tag: PRODUCER_12_5_RN
hxtlogobserver.cpp
Log Message:
Merge to PRODUCER_12_5_RN.
Description
--------------------------------------------
Log observers are initially subscribed with IHXTDeliveryManager::Subscribe().
Filters for log observers are updated with IHXTDeliveryManager::SetFilter().
In both cases, an IUnknown* is passed in to identify the IHXTLogObserver.
In the file log observer, the IUnknown* we passed into Subscribe() was taken by doing a QueryInterface() on the IHXTFileObserver object for IUnknown. However, for the SetFilter method, the IUnknown was obtained by doing a cast to IHXTFileObserver and then having the compiler cast this to IUnknown. This was producing a different IUnknown value from Subscribe() and was therefore making it impossible to update the file observer's filter that it was initially subscribed with.
Note that this bug was introduced in my changes to integrate client and producer logging. These changes were only on the HEAD (and the PRODUCER_12_5_RN branch.
Files Modified
--------------------------------------------
common/log/logobserverfile/hxtlogobserver.cpp
Branches
--------------------------------------------
HEAD and PRODUCER_12_5_RN
Index: hxtlogobserver.cpp
===================================================================
RCS file: /cvsroot/common/log/logobserverfile/hxtlogobserver.cpp,v
retrieving revision 1.24
retrieving revision 1.24.4.1
diff -u -d -r1.24 -r1.24.4.1
--- hxtlogobserver.cpp 10 Mar 2009 19:59:42 -0000 1.24
+++ hxtlogobserver.cpp 6 Apr 2009 18:46:21 -0000 1.24.4.1
@@ -1037,11 +1037,22 @@
sFilterString += m_sFAFilter;
sFilterString += "\"></Filter>";
- IHXTLogObserverManager* pIObserverManager = NULL;
- if( m_pLogSystem && SUCCEEDED(m_pLogSystem->GetObserverManagerInterface(&pIObserverManager)))
+ if (m_pLogSystem)
{
- pIObserverManager->SetFilter(sFilterString, (IHXTFileObserver*)this);
- HX_RELEASE(pIObserverManager);
+ IHXTLogObserverManager* pLogObserverMgr = NULL;
+ HX_RESULT rv = m_pLogSystem->GetObserverManagerInterface(&pLogObserverMgr);
+ if (SUCCEEDED(rv))
+ {
+ // QI for our own IUnknown
+ IUnknown* pUnk = NULL;
+ rv = QueryInterface(IID_IUnknown, (void**) &pUnk);
+ if (SUCCEEDED(rv))
+ {
+ pLogObserverMgr->SetFilter((const char*) sFilterString, pUnk);
+ }
+ HX_RELEASE(pUnk);
+ }
+ HX_RELEASE(pLogObserverMgr);
}
}