浏览代码

Clean incoming data when other side is gone

Ivo Wolf 12 年之前
父节点
当前提交
ca34f3ac0e

+ 8 - 0
Plugins/org.commontk.dah.core/ctkDicomAbstractExchangeCache.cpp

@@ -130,3 +130,11 @@ bool ctkDicomAbstractExchangeCache::notifyDataAvailable(const ctkDicomAppHosting
   emit internalDataAvailable();
   return true;
 }
+
+//----------------------------------------------------------------------------
+void ctkDicomAbstractExchangeCache::cleanIncomingData()
+{
+  Q_D(ctkDicomAbstractExchangeCache);
+  d->IncomingAvailableData = ctkDicomAppHosting::AvailableData();
+  d->lastIncomingData = false;
+}

+ 8 - 0
Plugins/org.commontk.dah.core/ctkDicomAbstractExchangeCache.h

@@ -119,6 +119,14 @@ public:
   */
   bool notifyDataAvailable(const ctkDicomAppHosting::AvailableData& data, bool lastData);
 
+  /**
+   * @brief Clean internal data stucture that keeps the incoming data.
+   *
+   * Called when other side is gone (i.e., usually the other side is a hosted app).
+   *
+  */
+  void cleanIncomingData();
+
 Q_SIGNALS:
 
   void dataAvailable();

+ 1 - 0
Plugins/org.commontk.dah.examplehost/ctkExampleDicomHost.cpp

@@ -163,6 +163,7 @@ void ctkExampleDicomHost::onCanceled()
 void ctkExampleDicomHost::onExited()
 {
   qDebug() << "App exited";
+  cleanIncomingData();
 }
 
 //----------------------------------------------------------------------------