Commit 8ca27ef3 authored by Albert Astals Cid's avatar Albert Astals Cid

Fix crash when closing

Unregister the part dbus object when it gets destroyed

Also fixes a crash if you try to inspect okular with qdbusviewer after having closed the a part/tab

BUGS: 384142
parent 9a25ea41
......@@ -349,10 +349,11 @@ m_cliPresentation(false), m_cliPrint(false), m_embedMode(detectEmbedMode(parentW
numberOfParts++;
if (numberOfParts == 1) {
QDBusConnection::sessionBus().registerObject(QStringLiteral("/okular"), this, QDBusConnection::ExportScriptableSlots);
m_registerDbusName = QStringLiteral("/okular");
} else {
QDBusConnection::sessionBus().registerObject(QStringLiteral("/okular%1").arg(numberOfParts), this, QDBusConnection::ExportScriptableSlots);
m_registerDbusName = QStringLiteral("/okular%1").arg(numberOfParts);
}
QDBusConnection::sessionBus().registerObject(m_registerDbusName, this, QDBusConnection::ExportScriptableSlots);
// connect the started signal to tell the job the mimetypes we like,
// and get some more information from it
......@@ -882,6 +883,8 @@ void Part::setupActions()
Part::~Part()
{
QDBusConnection::sessionBus().unregisterObject(m_registerDbusName);
GuiUtils::removeIconLoader( iconLoader() );
m_document->removeObserver( this );
......
......@@ -359,6 +359,8 @@ class OKULARPART_EXPORT Part : public KParts::ReadWritePart, public Okular::Docu
// Timer for m_infoMessage
QTimer *m_infoTimer;
QString m_registerDbusName;
private Q_SLOTS:
void slotAnnotationPreferences();
void slotHandleActivatedSourceReference(const QString& absFileName, int line, int col, bool *handled);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment