record managedLayout connectios and release them

pull/2/head
Michail Vourlakos 7 years ago
parent 0120d8635b
commit 67b1311f6f

@ -1373,6 +1373,11 @@ void DockView::setManagedLayout(Layout *layout)
return;
}
// clear mode
for (auto &c : connectionsManagedLayout) {
disconnect(c);
}
m_managedLayout = layout;
if (m_managedLayout) {
@ -1390,7 +1395,7 @@ void DockView::setManagedLayout(Layout *layout)
DockCorona *dockCorona = qobject_cast<DockCorona *>(this->corona());
if (dockCorona->layoutManager()->memoryUsage() == Dock::MultipleLayouts) {
connect(dockCorona->activitiesConsumer(), &KActivities::Consumer::runningActivitiesChanged, this, [&]() {
connectionsManagedLayout[0] = connect(dockCorona->activitiesConsumer(), &KActivities::Consumer::runningActivitiesChanged, this, [&]() {
if (m_managedLayout) {
qDebug() << "DOCK VIEW FROM LAYOUT (runningActivitiesChanged) ::: " << m_managedLayout->name()
<< " - activities: " << m_managedLayout->appliedActivities();
@ -1399,14 +1404,14 @@ void DockView::setManagedLayout(Layout *layout)
}
});
connect(m_managedLayout, &Layout::activitiesChanged, this, [&]() {
connectionsManagedLayout[1] = connect(m_managedLayout, &Layout::activitiesChanged, this, [&]() {
if (m_managedLayout) {
m_visibility->setDockOnActivities(m_managedLayout->appliedActivities());
emit activitiesChanged();
}
});
connect(dockCorona->layoutManager(), &LayoutManager::layoutsChanged, this, [&]() {
connectionsManagedLayout[2] = connect(dockCorona->layoutManager(), &LayoutManager::layoutsChanged, this, [&]() {
if (m_managedLayout) {
m_visibility->setDockOnActivities(m_managedLayout->appliedActivities());
emit activitiesChanged();
@ -1415,7 +1420,7 @@ void DockView::setManagedLayout(Layout *layout)
//!IMPORTANT!!! ::: This fixes a bug when closing an Activity all docks from all Activities are
//! disappearing! With this they reappear!!!
connect(this, &QWindow::visibleChanged, this, [&]() {
connectionsManagedLayout[3] = connect(this, &QWindow::visibleChanged, this, [&]() {
if (!isVisible() && m_managedLayout) {
QTimer::singleShot(100, [this]() {
if (m_managedLayout && containment() && !containment()->destroyed()) {

@ -336,6 +336,9 @@ private:
QTimer m_screenSyncTimer;
//! Connections to release and bound for the managed layout
std::array<QMetaObject::Connection, 4> connectionsManagedLayout;
//!used at sliding out/in animation
Plasma::Types::Location m_goToLocation{Plasma::Types::Floating};
QScreen *m_goToScreen{nullptr};

Loading…
Cancel
Save