Bug #423 resolved.
authorValentin Paramonov <valentine.paramonov@gmail.com>
Sat, 16 Nov 2013 00:22:37 +0000 (02:22 +0200)
committerValentin Paramonov <valentine.paramonov@gmail.com>
Sat, 16 Nov 2013 00:22:37 +0000 (02:22 +0200)
src/server/core/hk.cpp
src/server/core/netobj.cpp
src/server/include/nms_objects.h

index f75f733..58cd856 100644 (file)
  */
 static void DeleteEmptySubnets()
 {
-       ObjectArray<NetObj> *subnets = g_idxSubnetByAddr.getObjects(true);
+       ObjectArray<NetObj> *subnets = g_idxSubnetByAddr.getObjects(false);
        for(int i = 0; i < subnets->size(); i++)
        {
                NetObj *object = subnets->get(i);
                if (object->isEmpty())
                {
-         PostEvent(EVENT_SUBNET_DELETED, object->Id(), NULL);
+                  DbgPrintf(9, _T("Before call to delete: Object(%d) has %d refs, children: %d, parents: %d\n"),
+                     object->Id(), object->getRefCount(), object->getChildCount(), object->getParentCount());
                        object->deleteObject();
-         object->decRefCount();
                }
        }
        delete subnets;
index ee227ac..04d103e 100644 (file)
@@ -485,8 +485,8 @@ void NetObj::deleteObject()
 
    DbgPrintf(4, _T("Deleting object %d [%s]"), m_dwId, m_szName);
 
-       // Prevent object change propagation util it marked as deleted
-       // (to prevent object re-appearance in GUI if client hides object
+       // Prevent object change propagation until it's marked as deleted
+       // (to prevent the object's re-appearance in GUI if client hides the object
        // after successful call to Session::deleteObject())
        LockData();
    m_isHidden = true;
@@ -551,6 +551,7 @@ void NetObj::deleteObject()
  */
 void NetObj::onObjectDelete(UINT32 dwObjectId)
 {
+   PostEvent(EVENT_SUBNET_DELETED, dwObjectId, NULL);
 }
 
 /**
@@ -1543,3 +1544,13 @@ bool NetObj::showThresholdSummary()
 {
        return false;
 }
+
+int NetObj::getChildCount()
+{
+   return m_dwChildCount;
+}
+
+int NetObj::getParentCount()
+{
+   return m_dwParentCount;
+}
index 9034f7f..15d7075 100644 (file)
@@ -462,6 +462,9 @@ public:
 
        virtual bool showThresholdSummary();
 
+       virtual int getChildCount();
+       virtual int getParentCount();
+
    // Debug methods
    const TCHAR *dbgGetParentList(TCHAR *szBuffer);
    const TCHAR *dbgGetChildList(TCHAR *szBuffer);