]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/terminalsidebarpage.cpp
Fix memory leak using K_GLOBAL_STATIC
[dolphin.git] / src / terminalsidebarpage.cpp
index ced80ab9567be712b618c0a04d1c6e859fa347b2..4a82599f0c64d8c527c65be9dc99c6ac4fb581e8 100644 (file)
@@ -58,6 +58,13 @@ void TerminalSidebarPage::setUrl(const KUrl& url)
     }
 }
 
+void TerminalSidebarPage::terminalExited()
+{
+    emit hideTerminalSidebarPage();
+
+    m_terminal = 0;
+}
+
 void TerminalSidebarPage::showEvent(QShowEvent* event)
 {
     if (event->spontaneous()) {
@@ -69,6 +76,7 @@ void TerminalSidebarPage::showEvent(QShowEvent* event)
         KPluginFactory* factory = KPluginLoader("libkonsolepart").factory();
         KParts::ReadOnlyPart* part = factory ? (factory->create<KParts::ReadOnlyPart>(this)) : 0;
         if (part != 0) {
+            connect(part, SIGNAL(destroyed(QObject*)), this, SLOT(terminalExited()));
             m_terminalWidget = part->widget();
             m_layout->addWidget(m_terminalWidget);
             m_terminal = qobject_cast<TerminalInterface *>(part);