# HG changeset patch # User Alexis Jeandet # Date 2016-05-13 11:49:55 # Node ID f085b545eb20b88080337b12c5ed34a36e8e891b # Parent 1bb230d2507fb1e38a8de995e6f43aafe9bf43ce Removed crash on spwplugin while closing the manager thread didn't quit correctly. diff --git a/SocExplorer-plugins.spec b/SocExplorer-plugins.spec --- a/SocExplorer-plugins.spec +++ b/SocExplorer-plugins.spec @@ -1,8 +1,8 @@ -%global upstream_name socexplorer-plugins-0.7-0 +%global upstream_name socexplorer-plugins-0.7-2 Name: socexplorer-plugins Version: 0.7 -Release: 0%{?dist} +Release: 2%{?dist} Summary: Base plugins for SocExplorer. Group: Development/Tools License: GPLv2 @@ -65,6 +65,12 @@ make install INSTALL_ROOT=%{buildroot} %{_qt5_libdir}/SocExplorer/plugins/libspwplugin.so* %changelog +* Fri May 13 2016 Alexis Jeandet - 0.7-2 +- Fixed another segfault on SpwPlugin. + +* Thu Apr 21 2016 Alexis Jeandet - 0.7-1 +- Fixed segfault on SpwPlugin. + * Wed Apr 20 2016 Alexis Jeandet - 0.7-0 - Updated to SocExplorer 0.7, some work on spwplugin merged. diff --git a/spwplugin/StarDundee/stardundeespw_usb.cpp b/spwplugin/StarDundee/stardundeespw_usb.cpp --- a/spwplugin/StarDundee/stardundeespw_usb.cpp +++ b/spwplugin/StarDundee/stardundeespw_usb.cpp @@ -49,8 +49,7 @@ stardundeeSPW_USB::stardundeeSPW_USB(soc stardundeeSPW_USB::~stardundeeSPW_USB() { - this->manager->requestInterruption(); - while(this->manager->isRunning()); + } void stardundeeSPW_USB::toggleBridgeConnection() @@ -411,6 +410,9 @@ stardundeeSPW_USB_Manager::stardundeeSPW stardundeeSPW_USB_Manager::~stardundeeSPW_USB_Manager() { + if(this->connected)disconnectBridge(); + this->requestInterruption(); + while(!this->isFinished()); } void stardundeeSPW_USB_Manager::run() @@ -420,7 +422,7 @@ void stardundeeSPW_USB_Manager::run() USB_SPACEWIRE_STATUS stat; SocExplorerEngine::message(this->plugin,"Starting Startdundee USB pooling thread",1); char buffer[(RMAP_MAX_XFER_SIZE*4)+50]; - while (!this->isInterruptionRequested()) + while (!QThread::currentThread()->isInterruptionRequested()) { if(this->connected) { @@ -913,6 +915,7 @@ bool stardundeeSPW_USB_Manager::disconne this->RMAP_Answers.clear(); this->RMAP_AnswersMtx->unlock(); this->RMAP_AnswersSem->acquire(this->RMAP_AnswersSem->available()); + this->connected=false; return true; } diff --git a/spwplugin/StarDundee/stardundeespw_usb.h b/spwplugin/StarDundee/stardundeespw_usb.h --- a/spwplugin/StarDundee/stardundeespw_usb.h +++ b/spwplugin/StarDundee/stardundeespw_usb.h @@ -47,8 +47,8 @@ class stardundeeSPW_USB_Manager: public public: explicit stardundeeSPW_USB_Manager(socexplorerplugin *plugin = 0,QObject* parent=0); ~stardundeeSPW_USB_Manager(); - void run(); - bool connectBridge(); + virtual void run(); + virtual bool connectBridge(); bool connectBridgeAsInterface(); bool connectBridgeAsRouter(); void initDialog( void ); @@ -57,8 +57,8 @@ public: void initializeTimecodeGeneration(); void setTimecodeFrequency(double requestedFrequency); unsigned int getLinkStatus(unsigned char link); - bool disconnectBridge(); - bool sendPacket(char* packet,int size); + virtual bool disconnectBridge(); + virtual bool sendPacket(char* packet,int size); signals: void updateAvailableBrickCount(int count); diff --git a/spwplugin/abstractspwbridge.cpp b/spwplugin/abstractspwbridge.cpp --- a/spwplugin/abstractspwbridge.cpp +++ b/spwplugin/abstractspwbridge.cpp @@ -73,11 +73,8 @@ abstractSpwManager::abstractSpwManager(s abstractSpwManager::~abstractSpwManager() { - this->terminate(); - while (!this->isFinished()) - { - this->usleep(1000); - } + this->requestInterruption(); + while(!this->isFinished()); } int abstractSpwManager::getRMAPtransactionID() diff --git a/spwplugin/abstractspwbridge.h b/spwplugin/abstractspwbridge.h --- a/spwplugin/abstractspwbridge.h +++ b/spwplugin/abstractspwbridge.h @@ -74,7 +74,7 @@ class abstractSpwManager: public QThread public: explicit abstractSpwManager(socexplorerplugin *plugin = 0,QObject* parent=0); ~abstractSpwManager(); - virtual void run(){} + virtual void run(){}; virtual bool connectBridge()=0; virtual bool disconnectBridge()=0; int getRMAPtransactionID(); diff --git a/spwplugin/spwplugin.cpp b/spwplugin/spwplugin.cpp --- a/spwplugin/spwplugin.cpp +++ b/spwplugin/spwplugin.cpp @@ -31,7 +31,7 @@ spwplugin::spwplugin(QWidget *parent):so { Q_UNUSED(parent) FakeStarDundeeSpwUSB_Lib::resolve(); - this->bridge = NULL; + this->bridge = Q_NULLPTR; this->scanDone = false; // this->pyObject = new spwPyWrapper(this); this->tcpServer = new SpwTcpPacketServer(this); @@ -58,7 +58,8 @@ spwplugin::spwplugin(QWidget *parent):so spwplugin::~spwplugin() { - + if(this->bridge!=Q_NULLPTR) + delete this->bridge; }