Commit 1d2b2e34 authored by Peter Simonsson's avatar Peter Simonsson Committed by Srikanth Tiyyagura
Browse files

Fix crash on opening template in words

The crash occurs due to tool options docker trying to access
widgets that's already been deleted. To avoid this I reset the
widgets in the tool options dialog when a new document is loaded.

REVIEW: 102242
BUG: 272410
parent f767a556
......@@ -168,4 +168,9 @@ void KoDockerManager::newOptionWidgets(const QList<QWidget *> &optionWidgetList)
d->toolOptionsDocker->setOptionWidgets(optionWidgetList);
}
void KoDockerManager::resetToolDockerWidgets()
{
d->toolOptionsDocker->resetWidgets();
}
#include <KoDockerManager.moc>
......@@ -36,6 +36,8 @@ public:
explicit KoDockerManager(KoMainWindow* mainWindow);
~KoDockerManager();
void resetToolDockerWidgets();
public slots:
//void removeUnusedOptionWidgets();
/**
......
......@@ -447,6 +447,10 @@ void KoMainWindow::setRootDocument(KoDocument *doc)
if (oldRootDoc) {
oldRootDoc->removeShell(this);
if (dockerManager()) {
dockerManager()->resetToolDockerWidgets();
}
// Hide all dockwidgets and remember their old state
d->dockWidgetVisibilityMap.clear();
......
......@@ -71,6 +71,13 @@ public:
QToolButton *lockButton;
QToolButton *tabButton;
void resetWidgets()
{
currentWidgetList.clear();
qDeleteAll(currentAuxWidgets);
currentAuxWidgets.clear();
}
void recreateLayout(const QList<QWidget *> &optionWidgetList)
{
foreach(QWidget* widget, currentWidgetList) {
......@@ -276,4 +283,9 @@ void KoToolDocker::resizeEvent(QResizeEvent*)
d->tabButton->move(d->lockButton->x() - d->tabButton->width() - 2, d->lockButton->y());
}
void KoToolDocker::resetWidgets()
{
d->resetWidgets();
}
#include <KoToolDocker_p.moc>
......@@ -36,6 +36,8 @@ public:
explicit KoToolDocker(QWidget *parent = 0);
~KoToolDocker();
void resetWidgets();
protected:
virtual void resizeEvent(QResizeEvent* event); ///< reimplemented from QWidget
public slots:
......
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