mirror of
https://invent.kde.org/graphics/okular
synced 2024-10-05 23:49:20 +00:00
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
This commit is contained in:
parent
9a25ea41dc
commit
8ca27ef393
7
part.cpp
7
part.cpp
|
@ -349,10 +349,11 @@ m_cliPresentation(false), m_cliPrint(false), m_embedMode(detectEmbedMode(parentW
|
||||||
|
|
||||||
numberOfParts++;
|
numberOfParts++;
|
||||||
if (numberOfParts == 1) {
|
if (numberOfParts == 1) {
|
||||||
QDBusConnection::sessionBus().registerObject(QStringLiteral("/okular"), this, QDBusConnection::ExportScriptableSlots);
|
m_registerDbusName = QStringLiteral("/okular");
|
||||||
} else {
|
} 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,
|
// connect the started signal to tell the job the mimetypes we like,
|
||||||
// and get some more information from it
|
// and get some more information from it
|
||||||
|
@ -882,6 +883,8 @@ void Part::setupActions()
|
||||||
|
|
||||||
Part::~Part()
|
Part::~Part()
|
||||||
{
|
{
|
||||||
|
QDBusConnection::sessionBus().unregisterObject(m_registerDbusName);
|
||||||
|
|
||||||
GuiUtils::removeIconLoader( iconLoader() );
|
GuiUtils::removeIconLoader( iconLoader() );
|
||||||
m_document->removeObserver( this );
|
m_document->removeObserver( this );
|
||||||
|
|
||||||
|
|
2
part.h
2
part.h
|
@ -359,6 +359,8 @@ class OKULARPART_EXPORT Part : public KParts::ReadWritePart, public Okular::Docu
|
||||||
// Timer for m_infoMessage
|
// Timer for m_infoMessage
|
||||||
QTimer *m_infoTimer;
|
QTimer *m_infoTimer;
|
||||||
|
|
||||||
|
QString m_registerDbusName;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void slotAnnotationPreferences();
|
void slotAnnotationPreferences();
|
||||||
void slotHandleActivatedSourceReference(const QString& absFileName, int line, int col, bool *handled);
|
void slotHandleActivatedSourceReference(const QString& absFileName, int line, int col, bool *handled);
|
||||||
|
|
Loading…
Reference in a new issue