kpdf: fix crash when requested to shutdown from the session manager or dcop. This resolves issue #139

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/140/head
Michele Calgaro 4 months ago
parent 52b719af66
commit 2ce559458e
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -50,6 +50,7 @@ Shell::Shell()
: DCOPObject("KPDFShellDCOPIface"), KParts::MainWindow(0, "KPDF::Shell"),
m_menuBarWasShown(true),
m_toolBarWasShown(true),
m_shuttingDown(false),
m_showToolBarAction(nullptr),
m_tabs(nullptr),
m_tabsContextMenu(nullptr),
@ -63,6 +64,7 @@ Shell::Shell(const KURL &url)
: DCOPObject("KPDFShellDCOPIface"), KParts::MainWindow(0, "KPDF::Shell"),
m_menuBarWasShown(true),
m_toolBarWasShown(true),
m_shuttingDown(false),
m_showToolBarAction(nullptr),
m_tabs(nullptr),
m_tabsContextMenu(nullptr),
@ -101,6 +103,8 @@ void Shell::init()
this, TQ_SLOT(createGUI(KParts::Part*)));
connect(m_manager, TQ_SIGNAL(activePartChanged(KParts::Part*)),
this, TQ_SLOT(slotChangeTab(KParts::Part*)));
connect(tdeApp, TQ_SIGNAL(shutDown()),
this, TQ_SLOT(slotShutDown()));
setCentralWidget(m_tabs);
setXMLFile("shell.rc");
@ -433,8 +437,18 @@ void Shell::removeTab()
m_workingTab = -1;
}
void Shell::slotShutDown()
{
m_shuttingDown = true;
}
void Shell::slotChangeTab(KParts::Part *part)
{
if (m_shuttingDown)
{
return;
}
if (!part)
{
part = createTab();

@ -111,6 +111,7 @@ namespace KPDF
void slotUpdateFullScreen();
void slotShowMenubar();
void delayedOpen();
void slotShutDown();
void slotCloseTabRequest(TQWidget *w);
void slotChangeTab(KParts::Part *part);
@ -150,6 +151,7 @@ namespace KPDF
TQToolButton *m_addTabButton, *m_removeTabButton;
TQPopupMenu *m_tabsContextMenu;
bool m_menuBarWasShown, m_toolBarWasShown;
bool m_shuttingDown;
KURL m_openUrl; // delayed open
int m_workingTab;
};

Loading…
Cancel
Save