From 23a7c8316405eb5485885c5391ad4635253c709a Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Fri, 21 Nov 2008 03:43:45 +0000 Subject: [PATCH] clear the shortcuts editor pointer only when the dialog is actually dead and gone BUG:175722 svn path=/trunk/KDE/kdelibs/; revision=887090 --- applet.cpp | 9 ++++++--- applet.h | 1 + private/applet_p.h | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/applet.cpp b/applet.cpp index 51c0a6a38..3c79c23e2 100644 --- a/applet.cpp +++ b/applet.cpp @@ -1409,6 +1409,7 @@ void AppletPrivate::addGlobalShortcutsPage(KConfigDialog *dialog) if (!shortcutEditor) { shortcutEditor = new KKeySequenceWidget(page); + QObject::connect(shortcutEditor, SIGNAL(destroyed(QObject*)), q, SLOT(clearShortcutEditorPtr())); } shortcutEditor->setKeySequence(q->globalShortcut().primary()); @@ -1417,6 +1418,11 @@ void AppletPrivate::addGlobalShortcutsPage(KConfigDialog *dialog) dialog->addPage(page, i18n("Keyboard Shortcut"), "preferences-desktop-keyboard"); } +void AppletPrivate::clearShortcutEditorPtr() +{ + shortcutEditor = 0; +} + void Applet::configChanged() { if (d->script) { @@ -1429,9 +1435,6 @@ void Applet::configChanged() setGlobalShortcut(KShortcut(sequence)); emit configNeedsSaving(); } - - delete d->shortcutEditor; - d->shortcutEditor = 0; } } diff --git a/applet.h b/applet.h index aad27a6da..caf47b018 100644 --- a/applet.h +++ b/applet.h @@ -834,6 +834,7 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget Q_PRIVATE_SLOT(d, void selectItemToDestroy()) Q_PRIVATE_SLOT(d, void updateRect(const QRectF& rect)) Q_PRIVATE_SLOT(d, void destroyMessageOverlay()) + Q_PRIVATE_SLOT(d, void clearShortcutEditorPtr()) /** * Reimplemented from QGraphicsItem diff --git a/private/applet_p.h b/private/applet_p.h index 8594d5bfd..6182f9fd4 100644 --- a/private/applet_p.h +++ b/private/applet_p.h @@ -76,6 +76,7 @@ public: void createMessageOverlay(); void destroyMessageOverlay(); void addGlobalShortcutsPage(KConfigDialog *dialog); + void clearShortcutEditorPtr(); static uint s_maxAppletId; static uint s_maxZValue;