1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

Possible fix for mutex lockups on GCS exit

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2905 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
pip 2011-02-27 14:39:56 +00:00 committed by pip
parent 0124c42b8c
commit e3b6a29bfd
2 changed files with 10 additions and 8 deletions

View File

@ -40,7 +40,9 @@ TelemetryManager::TelemetryManager()
moveToThread(Core::ICore::instance()->threadManager()->getRealTimeThread()); moveToThread(Core::ICore::instance()->threadManager()->getRealTimeThread());
QMutexLocker locker(&mutex); // Pip mutex = new QMutex(QMutex::Recursive); // Pip
QMutexLocker locker(mutex); // Pip
// Get UAVObjectManager instance // Get UAVObjectManager instance
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
@ -59,14 +61,14 @@ TelemetryManager::TelemetryManager()
TelemetryManager::~TelemetryManager() TelemetryManager::~TelemetryManager()
{ {
// Pip // Pip
mutex.lock(); mutex->lock();
// deleteObjects(); // deleteObjects();
mutex.unlock(); mutex->unlock();
} }
void TelemetryManager::onObjectDestroyed(QObject *obj) // Pip void TelemetryManager::onObjectDestroyed(QObject *obj) // Pip
{ {
QMutexLocker locker(&mutex); QMutexLocker locker(mutex);
deleteObjects(); deleteObjects();
} }
@ -78,7 +80,7 @@ void TelemetryManager::start(QIODevice *dev)
void TelemetryManager::onStart() void TelemetryManager::onStart()
{ {
QMutexLocker locker(&mutex); // Pip QMutexLocker locker(mutex); // Pip
deleteObjects(); // Pip deleteObjects(); // Pip
@ -115,10 +117,10 @@ void TelemetryManager::stop()
void TelemetryManager::onStop() void TelemetryManager::onStop()
{ {
mutex.lock(); // Pip mutex->lock(); // Pip
if (telemetryMon) telemetryMon->disconnect(this); if (telemetryMon) telemetryMon->disconnect(this);
deleteObjects(); deleteObjects();
mutex.unlock(); mutex->unlock();
onDisconnect(); onDisconnect();
} }

View File

@ -69,7 +69,7 @@ private:
Telemetry* telemetry; Telemetry* telemetry;
TelemetryMonitor* telemetryMon; TelemetryMonitor* telemetryMon;
QIODevice *device; QIODevice *device;
QMutex mutex; QMutex *mutex;
void deleteObjects(); // Pip void deleteObjects(); // Pip
}; };