Commit 15dc9237 authored by Don Gagne's avatar Don Gagne

Guard again deletes not from LinkManager

parent e3dac790
...@@ -54,7 +54,9 @@ class LinkInterface : public QThread ...@@ -54,7 +54,9 @@ class LinkInterface : public QThread
public: public:
LinkInterface() : LinkInterface() :
QThread(0) QThread(0),
_ownedByLinkManager(false),
_deletedByLinkManager(false)
{ {
// Initialize everything for the data rate calculation buffers. // Initialize everything for the data rate calculation buffers.
inDataIndex = 0; inDataIndex = 0;
...@@ -73,7 +75,9 @@ public: ...@@ -73,7 +75,9 @@ public:
} }
virtual ~LinkInterface() { virtual ~LinkInterface() {
emit this->deleteLink(this); // LinkManager take ownership of Links once they are added to it. Once added to LinkManager
// user LinkManager::deleteLink to remove if necessary/
Q_ASSERT(!_ownedByLinkManager || _deletedByLinkManager);
} }
/* Connection management */ /* Connection management */
...@@ -197,9 +201,6 @@ signals: ...@@ -197,9 +201,6 @@ signals:
void communicationUpdate(const QString& linkname, const QString& text); void communicationUpdate(const QString& linkname, const QString& text);
/** @brief destroying element */
void deleteLink(LinkInterface* const link);
protected: protected:
static const int dataRateBufferSize = 20; ///< Specify how many data points to capture for data rate calculations. static const int dataRateBufferSize = 20; ///< Specify how many data points to capture for data rate calculations.
...@@ -334,6 +335,11 @@ private: ...@@ -334,6 +335,11 @@ private:
* @return True if connection could be terminated, false otherwise * @return True if connection could be terminated, false otherwise
**/ **/
virtual bool _disconnect(void) = 0; virtual bool _disconnect(void) = 0;
bool _ownedByLinkManager; ///< true: This link has been added to LinkManager, false: Link not added to LinkManager
bool _deletedByLinkManager; ///< true: Link being deleted from LinkManager, false: error, Links should only be deleted from LinkManager
friend class LinkManager;
}; };
#endif // _LINKINTERFACE_H_ #endif // _LINKINTERFACE_H_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment