89 lines
2.6 KiB
Diff
89 lines
2.6 KiB
Diff
|
From: Hartmut Riesenbeck <hartmut.riesenbeck@gmx.de>
|
||
|
Date: Fri, 25 Mar 2016 20:35:09 +0000
|
||
|
Subject: Fix never ending event loop when quitting app and segmentation faults
|
||
|
X-Git-Url: http://quickgit.kde.org/?p=parley.git&a=commitdiff&h=1ecfb75bdddc176cd8837d39935329fd02b9f910
|
||
|
---
|
||
|
Fix never ending event loop when quitting app and segmentation faults
|
||
|
|
||
|
When the app is quited app.exec() doesn't return. The process stays in
|
||
|
sleeping state. Removed app.setQuitOnLastWindowClosed(false) because
|
||
|
the quit() or exec() method of the application were not invoked
|
||
|
somewhere else in the application.
|
||
|
|
||
|
After this the app ends in the correct way. But after quit is invoked,
|
||
|
there are sporadic segmentation faults and the following message was
|
||
|
shown on stderr:
|
||
|
QCoreApplication::postEvent: Unexpected null receiver
|
||
|
This was fixed by removing zero pointer access in destuctor of
|
||
|
ParleyDocument.
|
||
|
|
||
|
Added missing this pointer on KEduVocDocument allocation.
|
||
|
|
||
|
REVIEW: 127441
|
||
|
---
|
||
|
|
||
|
|
||
|
--- a/src/main.cpp
|
||
|
+++ b/src/main.cpp
|
||
|
@@ -123,8 +123,6 @@
|
||
|
parser.process(app);
|
||
|
aboutData.processCommandLine(&parser);
|
||
|
|
||
|
- app.setQuitOnLastWindowClosed(false);
|
||
|
-
|
||
|
if (app.isSessionRestored()) {
|
||
|
int n = 1;
|
||
|
while (KMainWindow::canBeRestored(n)) {
|
||
|
|
||
|
--- a/src/parleydocument.cpp
|
||
|
+++ b/src/parleydocument.cpp
|
||
|
@@ -88,9 +88,6 @@
|
||
|
ParleyDocument::~ParleyDocument()
|
||
|
{
|
||
|
close();
|
||
|
- delete m_backupTimer;
|
||
|
- m_doc->deleteLater();
|
||
|
- emit documentChanged(0);
|
||
|
}
|
||
|
|
||
|
|
||
|
@@ -98,7 +95,7 @@
|
||
|
{
|
||
|
// If there is no present vocabulary document, create an empty one.
|
||
|
if (!m_doc) {
|
||
|
- m_doc = new KEduVocDocument();
|
||
|
+ m_doc = new KEduVocDocument(this);
|
||
|
}
|
||
|
|
||
|
return m_doc;
|
||
|
@@ -118,7 +115,7 @@
|
||
|
|
||
|
void ParleyDocument::newDocument(bool wizard)
|
||
|
{
|
||
|
- KEduVocDocument *newDoc = new KEduVocDocument();
|
||
|
+ KEduVocDocument *newDoc = new KEduVocDocument(this);
|
||
|
|
||
|
initializeDefaultGrammar(newDoc);
|
||
|
setDefaultDocumentProperties(newDoc);
|
||
|
|
||
|
--- a/src/parleymainwindow.cpp
|
||
|
+++ b/src/parleymainwindow.cpp
|
||
|
@@ -128,11 +128,11 @@
|
||
|
|
||
|
void ParleyMainWindow::documentUpdated(KEduVocDocument *doc)
|
||
|
{
|
||
|
- if (doc != 0) {
|
||
|
- connect(m_document->document(), &KEduVocDocument::docModified
|
||
|
- , this, &ParleyMainWindow::slotUpdateWindowCaption);
|
||
|
- connect(m_document->document(), &QObject::destroyed
|
||
|
- , this, &ParleyMainWindow::slotUpdateWindowCaption);
|
||
|
+ if (doc != nullptr) {
|
||
|
+ connect(doc, &KEduVocDocument::docModified,
|
||
|
+ this, &ParleyMainWindow::slotUpdateWindowCaption);
|
||
|
+ connect(doc, &KEduVocDocument::destroyed,
|
||
|
+ this, &ParleyMainWindow::slotUpdateWindowCaption);
|
||
|
slotUpdateWindowCaption();
|
||
|
}
|
||
|
}
|
||
|
|