fix two serious crashes from config window

--first is inside the freeEdges function call
on destruction
--the second is also in the app's destruction
because of the call to a destructed containment
through m_containment. This variable was deleted
v0.6
Michail Vourlakos 8 years ago
parent 39402be134
commit 33249a917b

@ -38,7 +38,6 @@ namespace Latte {
DockConfigView::DockConfigView(Plasma::Containment *containment, DockView *dockView, QWindow *parent)
: PlasmaQuick::ConfigView(containment, parent),
m_blockFocusLost(false),
m_containment(containment),
m_dockView(dockView)
{
connections << connect(dockView, &QObject::destroyed, this, &QObject::deleteLater);
@ -78,7 +77,7 @@ void DockConfigView::init()
rootContext()->setContextProperty(QStringLiteral("dock"), m_dockView);
rootContext()->setContextProperty(QStringLiteral("dockConfig"), this);
rootContext()->setContextObject(new KLocalizedContext(this));
auto source = QUrl::fromLocalFile(m_containment->corona()->kPackage().filePath("lattedockconfigurationui"));
auto source = QUrl::fromLocalFile(m_dockView->containment()->corona()->kPackage().filePath("lattedockconfigurationui"));
setSource(source);
syncSlideEffect();
}
@ -90,13 +89,13 @@ inline Qt::WindowFlags DockConfigView::wFlags() const
void DockConfigView::syncGeometry()
{
if (!m_containment || !rootObject())
if (!m_dockView->containment() || !rootObject())
return;
const auto location = m_containment->location();
const auto location = m_dockView->containment()->location();
const auto sGeometry = screen()->geometry();
switch (m_containment->formFactor()) {
switch (m_dockView->containment()->formFactor()) {
case Plasma::Types::Horizontal: {
const QSize size(rootObject()->width(), rootObject()->height());
setMaximumSize(size);
@ -137,12 +136,12 @@ void DockConfigView::syncGeometry()
void DockConfigView::syncSlideEffect()
{
if (!m_containment)
if (!m_dockView->containment())
return;
KWindowEffects::SlideFromLocation slideLocation{KWindowEffects::NoEdge};
switch (m_containment->location()) {
switch (m_dockView->containment()->location()) {
case Plasma::Types::TopEdge:
slideLocation = KWindowEffects::TopEdge;
break;
@ -178,8 +177,8 @@ void DockConfigView::showEvent(QShowEvent *ev)
syncGeometry();
syncSlideEffect();
if (m_containment)
m_containment->setUserConfiguring(true);
if (m_dockView && m_dockView->containment())
m_dockView->containment()->setUserConfiguring(true);
m_screenSyncTimer.start();
QTimer::singleShot(400, this, &DockConfigView::syncGeometry);
@ -187,9 +186,8 @@ void DockConfigView::showEvent(QShowEvent *ev)
void DockConfigView::hideEvent(QHideEvent *ev)
{
if (m_containment && m_dockView) {
m_containment->setUserConfiguring(false);
}
if (m_dockView && m_dockView->containment())
m_dockView->containment()->setUserConfiguring(false);
QQuickWindow::hideEvent(ev);
}

@ -67,7 +67,6 @@ private slots:
private:
bool m_blockFocusLost;
Plasma::Containment *m_containment{nullptr};
QPointer<DockView> m_dockView;
QTimer m_screenSyncTimer;

@ -95,6 +95,11 @@ DockView::~DockView()
this->disconnect();
qDebug() << "dock view connections deleted...";
if (m_configView) {
m_configView->hide();
m_configView->deleteLater();
}
if (m_visibility) {
delete m_visibility;
}
@ -431,6 +436,11 @@ bool DockView::event(QEvent *e)
QList<int> DockView::freeEdges() const
{
if (!corona() || !containment()) {
const QList<int> emptyEdges;
return emptyEdges;
}
const auto edges = corona()->freeEdges(containment()->screen());
QList<int> edgesInt;
@ -445,13 +455,8 @@ void DockView::closeApplication()
{
DockCorona *dockCorona = qobject_cast<DockCorona *>(this->corona());
if (dockCorona) {
//m_configView->hide();
if (m_configView)
m_configView->deleteLater();
if (dockCorona)
dockCorona->closeApplication();
}
}
QVariantList DockView::containmentActions()

Loading…
Cancel
Save