summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Gottfried <sebastian.gottfried@posteo.de>2016-10-13 08:52:09 (GMT)
committerSebastian Gottfried <sebastian.gottfried@posteo.de>2016-10-13 08:52:09 (GMT)
commita04275a4d3ca7e83f2592fea59920addfc317049 (patch)
treec40e5a356959bd878c7d4d92805efad47c349147
parent0e9b3907861120f61bcb8cbd891e970c5738f2b2 (diff)
Fix Crash On Exit With Resource Editor
The QSharedPointer used to hold a app-global reference to the resource editor tries to delete the window even if it has already deleted itself when closing the editor. This is fixed now by using a QPointer.
-rw-r--r--src/application.cpp2
-rw-r--r--src/application.h6
-rw-r--r--src/ktouchcontext.cpp4
-rw-r--r--src/main.cpp8
4 files changed, 10 insertions, 10 deletions
diff --git a/src/application.cpp b/src/application.cpp
index 5fa0d06..4ef411e 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -70,7 +70,7 @@ DataIndex* Application::dataIndex()
return app->m_dataIndex;
}
-QSharedPointer<ResourceEditor>& Application::resourceEditorRef()
+QPointer<ResourceEditor>& Application::resourceEditorRef()
{
Application* app = qobject_cast<Application*>(QCoreApplication::instance());
diff --git a/src/application.h b/src/application.h
index 7b1ec17..0113eac 100644
--- a/src/application.h
+++ b/src/application.h
@@ -19,7 +19,7 @@
#define APPLICATION_H
#include <QApplication>
-#include <QSharedPointer>
+#include <QPointer>
#include "editor/resourceeditor.h"
@@ -33,13 +33,13 @@ public:
Application(int& argc, char** argv, int flags = ApplicationFlags);
static DataIndex* dataIndex();
static void setupDeclarativeBindings(QQmlEngine* qmlEngine);
- static QSharedPointer<ResourceEditor>& resourceEditorRef();
+ static QPointer<ResourceEditor>& resourceEditorRef();
QStringList& qmlImportPaths();
private:
void registerQmlTypes();
void migrateKde4Files();
DataIndex* m_dataIndex;
- QSharedPointer<ResourceEditor> m_resourceEditorRef;
+ QPointer<ResourceEditor> m_resourceEditorRef;
QStringList m_qmlImportPaths;
};
diff --git a/src/ktouchcontext.cpp b/src/ktouchcontext.cpp
index 3a03da1..006c901 100644
--- a/src/ktouchcontext.cpp
+++ b/src/ktouchcontext.cpp
@@ -97,10 +97,10 @@ void KTouchContext::showMenu(int xPos, int yPos)
void KTouchContext::showResourceEditor()
{
- QSharedPointer<ResourceEditor>& resourceEditorRef = Application::resourceEditorRef();
+ QPointer<ResourceEditor>& resourceEditorRef = Application::resourceEditorRef();
if (resourceEditorRef.isNull())
{
- resourceEditorRef = QSharedPointer<ResourceEditor>(new ResourceEditor());
+ resourceEditorRef = QPointer<ResourceEditor>(new ResourceEditor());
}
ResourceEditor* resourceEditor = resourceEditorRef.data();
diff --git a/src/main.cpp b/src/main.cpp
index fda7e82..3b7739c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -95,11 +95,11 @@ int main(int argc, char **argv)
}
else if (name == "ResourceEditor")
{
- QSharedPointer<ResourceEditor>& resourceEditorRef = Application::resourceEditorRef();
+ QPointer<ResourceEditor>& resourceEditorRef = Application::resourceEditorRef();
if (resourceEditorRef.isNull())
{
- resourceEditorRef = QSharedPointer<ResourceEditor>(new ResourceEditor());
+ resourceEditorRef = QPointer<ResourceEditor>(new ResourceEditor());
resourceEditorRef.data()->restore(i);
}
}
@@ -109,10 +109,10 @@ int main(int argc, char **argv)
{
if (parser.isSet("resource-editor"))
{
- QSharedPointer<ResourceEditor>& resourceEditorRef = Application::resourceEditorRef();
+ QPointer<ResourceEditor>& resourceEditorRef = Application::resourceEditorRef();
if (resourceEditorRef.isNull())
{
- resourceEditorRef = QSharedPointer<ResourceEditor>(new ResourceEditor());
+ resourceEditorRef = QPointer<ResourceEditor>(new ResourceEditor());
}
ResourceEditor* resourceEditor = resourceEditorRef.data();