Avoid crash due to reentrancy in KDirWatch dirty/created/deleted signals

pull/1/head
Timothy Pearson 11 years ago
parent 50e86769ec
commit 9d3eb438cc

@ -1 +1 @@
Subproject commit 65ecce459d54e772303052de50d08557ba9cc7ed Subproject commit 4027b878fb556a51ed29affd578e78aa70997480

@ -59,7 +59,7 @@
#include "toplevel.h" #include "toplevel.h"
#include "toplevel.moc" #include "toplevel.moc"
TopLevel::TopLevel() : KSystemTray(), ticketWatch(0), m_refreshTimer(0), notifyExpiryMinutes(0) TopLevel::TopLevel() : KSystemTray(), ticketWatch(0), m_refreshTimer(0), m_requestUpdateTimer(0), notifyExpiryMinutes(0)
{ {
setBackgroundMode(X11ParentRelative); // what for? setBackgroundMode(X11ParentRelative); // what for?
@ -145,6 +145,15 @@ void TopLevel::setupTimers() {
connect(m_refreshTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(updateTicketList())); connect(m_refreshTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(updateTicketList()));
m_refreshTimer->start(10*1000, false); m_refreshTimer->start(10*1000, false);
} }
if (!m_requestUpdateTimer) {
m_requestUpdateTimer = new TQTimer(this);
connect(m_requestUpdateTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(updateTicketList()));
}
}
void TopLevel::requestTicketListUpdate() {
m_requestUpdateTimer->start(0, TRUE);
} }
void TopLevel::updateTicketList() { void TopLevel::updateTicketList() {
@ -154,9 +163,9 @@ void TopLevel::updateTicketList() {
if (!ticketWatch) { if (!ticketWatch) {
ticketWatch = new KDirWatch(); ticketWatch = new KDirWatch();
connect(ticketWatch, TQT_SIGNAL(dirty(const TQString&)), this, TQT_SLOT(updateTicketList())); connect(ticketWatch, TQT_SIGNAL(dirty(const TQString&)), this, TQT_SLOT(requestTicketListUpdate()));
connect(ticketWatch, TQT_SIGNAL(created(const TQString&)), this, TQT_SLOT(updateTicketList())); connect(ticketWatch, TQT_SIGNAL(created(const TQString&)), this, TQT_SLOT(requestTicketListUpdate()));
connect(ticketWatch, TQT_SIGNAL(deleted(const TQString&)), this, TQT_SLOT(updateTicketList())); connect(ticketWatch, TQT_SIGNAL(deleted(const TQString&)), this, TQT_SLOT(requestTicketListUpdate()));
ticketWatch->addFile(m_ticketFile); ticketWatch->addFile(m_ticketFile);
ticketWatch->startScan(); ticketWatch->startScan();
} }

@ -64,6 +64,7 @@ private slots:
void setToolTip(const TQString &text, bool force=false); void setToolTip(const TQString &text, bool force=false);
void setupTimers(); void setupTimers();
void requestTicketListUpdate();
void updateTicketList(); void updateTicketList();
void updateMenu(); void updateMenu();
void getNewTGT(); void getNewTGT();
@ -92,6 +93,7 @@ private:
TQString m_ticketFile; TQString m_ticketFile;
KDirWatch *ticketWatch; KDirWatch *ticketWatch;
TQTimer *m_refreshTimer; TQTimer *m_refreshTimer;
TQTimer *m_requestUpdateTimer;
bool autostart; bool autostart;
bool notifyExpiry; bool notifyExpiry;

Loading…
Cancel
Save