[openrtm-commit:01821] r687 - trunk/OpenRTM-aist-Python/OpenRTM_aist

openrtm @ openrtm.org openrtm @ openrtm.org
2016年 3月 7日 (月) 10:21:30 JST


Author: miyamoto
Date: 2016-03-07 10:21:30 +0900 (Mon, 07 Mar 2016)
New Revision: 687

Modified:
   trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortSHMConsumer.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortSHMConsumer.py
   trunk/OpenRTM-aist-Python/OpenRTM_aist/SharedMemory.py
Log:
[compat,bugfix,->RELENG_1_2] bug fix. refs #3410

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortSHMConsumer.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortSHMConsumer.py	2016-03-06 17:13:06 UTC (rev 686)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/InPortSHMConsumer.py	2016-03-07 01:21:30 UTC (rev 687)
@@ -137,8 +137,12 @@
     if OpenRTM_aist.CorbaConsumer.setObject(self, obj):
       ref_ = self.getObject()
       if ref_:
-        inportcdr = ref_._narrow(OpenRTM__POA.PortSharedMemory)
-        self._shmem.setInterface(inportcdr)
+        try:
+          inportcdr = ref_._narrow(OpenRTM__POA.PortSharedMemory)
+          self._shmem.setInterface(inportcdr)
+        except:
+          self._rtcout.RTC_WARN("Exception caught from PortSharedMemory.setInterface().")
+          self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
         
         return True
     return False

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortSHMConsumer.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortSHMConsumer.py	2016-03-06 17:13:06 UTC (rev 686)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/OutPortSHMConsumer.py	2016-03-07 01:21:30 UTC (rev 687)
@@ -15,6 +15,7 @@
 import OpenRTM_aist
 import OpenRTM
 import OpenRTM__POA
+import CORBA
 
 import threading
 
@@ -59,7 +60,7 @@
     self._shmem = OpenRTM_aist.SharedMemory()
       
     self._mutex = threading.RLock()
-    self._outportcdr = None
+    self._outportcdr = OpenRTM.PortSharedMemory._nil
 
     return
 
@@ -79,8 +80,13 @@
   def __del__(self, CorbaConsumer=OpenRTM_aist.CorbaConsumer):
     self._rtcout.RTC_PARANOID("~OutPortSHMConsumer()")
     CorbaConsumer.__del__(self)
-    if self._outportcdr:
-      self._outportcdr.close_memory(True)
+    try:
+      if not CORBA.is_nil(self._outportcdr):
+        self._outportcdr.close_memory(True)
+    except:
+      self._rtcout.RTC_WARN("Exception caught from PortSharedMemory.close_memory().")
+      self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
+      
     oid = OpenRTM_aist.Manager.instance().getPOA().servant_to_id(self._shmem)
     OpenRTM_aist.Manager.instance().getPOA().deactivate_object(oid)
 
@@ -113,10 +119,14 @@
   def setObject(self, obj):
     if OpenRTM_aist.CorbaConsumer.setObject(self, obj):
       ref_ = self.getObject()
-      if ref_:
-        outportcdr = self.getObject()._narrow(OpenRTM__POA.PortSharedMemory)
-        outportcdr.setInterface(self._shmem._this())
-        return True
+      try:
+        if ref_:
+          outportcdr = self.getObject()._narrow(OpenRTM__POA.PortSharedMemory)
+          outportcdr.setInterface(self._shmem._this())
+          return True
+      except:
+        self._rtcout.RTC_WARN("Exception caught from PortSharedMemory.setInterface().")
+        self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
     return False
   
 

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/SharedMemory.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/SharedMemory.py	2016-03-06 17:13:06 UTC (rev 686)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/SharedMemory.py	2016-03-07 01:21:30 UTC (rev 687)
@@ -16,6 +16,7 @@
 import CORBA
 import OpenRTM_aist
 import OpenRTM__POA
+import OpenRTM
 
 
 
@@ -65,7 +66,7 @@
   def __init__(self):
     self._rtcout = OpenRTM_aist.Manager.instance().getLogbuf("SharedMemory")
     self._shmem = None
-    self._smInterface = None
+    self._smInterface = OpenRTM.PortSharedMemory._nil
     self._shm_address = ""
     self._memory_size = SharedMemory.default_memory_size
     if platform.system() == "Windows":
@@ -194,7 +195,7 @@
         self.rt.close( self.fd )
 
       
-      if self._smInterface:
+      if not CORBA.is_nil(self._smInterface):
         self._smInterface.open_memory(self._memory_size, self._shm_address)
 
 
@@ -265,7 +266,7 @@
            self.rt.shm_unlink(self._shm_address)
       self._shmem = None
 
-      if self._smInterface:
+      if not CORBA.is_nil(self._smInterface):
         self._smInterface.close_memory(False)
 
   
@@ -304,7 +305,7 @@
       if data_size + SharedMemory.default_size > self._memory_size:
         self._memory_size = data_size + SharedMemory.default_size
 
-        if self._smInterface:
+        if not CORBA.is_nil(self._smInterface):
           self._smInterface.close_memory(False)
 
 



More information about the openrtm-commit mailing list