[Kst] kdeextragear-2/kst/kst
George Staikos
staikos at kde.org
Wed Dec 8 22:20:40 CET 2004
CVS commit by staikos:
Possibly found a cause of Kst not cleaning up properly on exit. I think the
delay loops became infinite in some cases (race), and so the update thread
would never exit, and then KstApp gives up, kills the thread, and this triggers
a race with KstDoc. I'd be interested to know if this crashes or causes
invalid memory access on RedHat 9 still.
M +2 -7 kst.cpp 1.265
M +7 -3 updatethread.cpp 1.36
--- kdeextragear-2/kst/kst/kst.cpp #1.264:1.265
@@ -218,5 +218,5 @@ KstApp::KstApp(QWidget *parent, const ch
menuBar()->insertItem(i18n("&Window"), windowMenu());
}
- QObject::connect( windowMenu(), SIGNAL(aboutToShow()), this, SLOT(addNewWindowMenu()) );
+ connect(windowMenu(), SIGNAL(aboutToShow()), this, SLOT(addNewWindowMenu()));
}
}
@@ -225,12 +225,7 @@ KstApp::KstApp(QWidget *parent, const ch
KstApp::~KstApp() {
_updateThread->setFinished(true);
-#if 0
- if (!_updateThread->wait(250)) { // 250ms
+ if (!_updateThread->wait(3000)) { // 3s
_updateThread->terminate();
-#endif
- _updateThread->wait(3000); // QThread object destroyed while thread running on RH 9, but freezes on exit without it. ->terminate() crashes. Can we win?
-#if 0
}
-#endif
KstDataSource::cleanupForExit(); // must be before deletions
--- kdeextragear-2/kst/kst/updatethread.cpp #1.35:1.36
@@ -63,4 +63,8 @@ void UpdateThread::run() {
_statusMutex.lock();
+ if (_done) {
+ _statusMutex.unlock();
+ break;
+ }
force = _force;
_force = false;
@@ -75,5 +79,5 @@ void UpdateThread::run() {
bool gotData = false;
- if (doUpdates(force, &gotData)) {
+ if (doUpdates(force, &gotData) && !_done) {
#if UPDATEDEBUG > 1
kdDebug() << "Update resulted in: TRUE!" << endl;
@@ -101,5 +105,5 @@ void UpdateThread::run() {
usleep(1000); // 1 ms on 2.6 kernel. 10ms on 2.4 kernel
- while (_doc->updating()) { // wait for the UI to finish old events
+ while (!_done && _doc->updating()) { // wait for the UI to finish old events
usleep(1000);
}
@@ -107,5 +111,5 @@ void UpdateThread::run() {
// check again... not strictly needed given implicit repaint below,
// but it should just return false, so no harm done.
- while (_doc->updating()) {
+ while (!_done && _doc->updating()) {
usleep(1000);
}
More information about the Kst
mailing list