fix random crash on interface shutdown

This commit is contained in:
ZappoMan 2014-01-23 14:57:32 -08:00
parent d556581842
commit bdcca9cbf4
6 changed files with 17 additions and 1 deletions

View file

@ -18,6 +18,7 @@
VoxelHideShowThread::VoxelHideShowThread(VoxelSystem* theSystem) : VoxelHideShowThread::VoxelHideShowThread(VoxelSystem* theSystem) :
_theSystem(theSystem) { _theSystem(theSystem) {
//qDebug() << "VoxelHideShowThread::VoxelHideShowThread() this=" << this;
} }
bool VoxelHideShowThread::process() { bool VoxelHideShowThread::process() {

View file

@ -18,6 +18,9 @@
JurisdictionListener::JurisdictionListener(NODE_TYPE type, PacketSenderNotify* notify) : JurisdictionListener::JurisdictionListener(NODE_TYPE type, PacketSenderNotify* notify) :
_packetSender(notify, JurisdictionListener::DEFAULT_PACKETS_PER_SECOND) _packetSender(notify, JurisdictionListener::DEFAULT_PACKETS_PER_SECOND)
{ {
//qDebug() << "JurisdictionListener::JurisdictionListener() this=" << this;
//qDebug() << "JurisdictionListener::JurisdictionListener() this=" << this << " _packetSender=" << &_packetSender;
_nodeType = type; _nodeType = type;
ReceivedPacketProcessor::_dontSleep = true; // we handle sleeping so this class doesn't need to ReceivedPacketProcessor::_dontSleep = true; // we handle sleeping so this class doesn't need to

View file

@ -20,6 +20,7 @@ OctreePersistThread::OctreePersistThread(Octree* tree, const QString& filename,
_persistInterval(persistInterval), _persistInterval(persistInterval),
_initialLoadComplete(false), _initialLoadComplete(false),
_loadTimeUSecs(0) { _loadTimeUSecs(0) {
//qDebug() << "OctreePersistThread::OctreePersistThread()... this=" << this;
} }
bool OctreePersistThread::process() { bool OctreePersistThread::process() {

View file

@ -17,10 +17,16 @@ GenericThread::GenericThread() :
_stopThread(false), _stopThread(false),
_isThreaded(false) // assume non-threaded, must call initialize() _isThreaded(false) // assume non-threaded, must call initialize()
{ {
//qDebug() << "GenericThread::GenericThread() this=" << this;
} }
GenericThread::~GenericThread() { GenericThread::~GenericThread() {
terminate(); //qDebug() << "GenericThread::~GenericThread() this=" << this;
// we only need to call terminate() if we're actually threaded and still running
if (isStillRunning() && isThreaded()) {
terminate();
}
} }
void GenericThread::initialize(bool isThreaded) { void GenericThread::initialize(bool isThreaded) {
@ -39,12 +45,14 @@ void GenericThread::initialize(bool isThreaded) {
} }
void GenericThread::terminate() { void GenericThread::terminate() {
//qDebug() << "GenericThread::terminate()... this=" << this;
if (_isThreaded) { if (_isThreaded) {
_stopThread = true; _stopThread = true;
if (_thread) { if (_thread) {
_thread->wait(); _thread->wait();
_thread->deleteLater(); _thread->deleteLater();
_thread = NULL;
} }
} }
} }
@ -66,6 +74,7 @@ void GenericThread::threadRoutine() {
// If we were on a thread, then quit our thread // If we were on a thread, then quit our thread
if (_isThreaded && _thread) { if (_isThreaded && _thread) {
//qDebug() << "GenericThread::threadRoutine()... about to call _thread->quit() this=" << this << " _thread=" << _thread;
_thread->quit(); _thread->quit();
} }

View file

@ -42,6 +42,7 @@ PacketSender::PacketSender(PacketSenderNotify* notify, int packetsPerSecond) :
_totalPacketsQueued(0), _totalPacketsQueued(0),
_totalBytesQueued(0) _totalBytesQueued(0)
{ {
//qDebug() << "PacketSender::PacketSender()... this=" << this;
} }
PacketSender::~PacketSender() { PacketSender::~PacketSender() {

View file

@ -14,6 +14,7 @@
ReceivedPacketProcessor::ReceivedPacketProcessor() { ReceivedPacketProcessor::ReceivedPacketProcessor() {
_dontSleep = false; _dontSleep = false;
//qDebug() << "ReceivedPacketProcessor::ReceivedPacketProcessor()... this=" << this;
} }
void ReceivedPacketProcessor::queueReceivedPacket(const HifiSockAddr& address, unsigned char* packetData, ssize_t packetLength) { void ReceivedPacketProcessor::queueReceivedPacket(const HifiSockAddr& address, unsigned char* packetData, ssize_t packetLength) {