on xenial help sign in
fixed workspace crash
80fc88dNick Dedekind
plugins/WindowManager/WorkspaceModel.cpp+15−10
@@ -55,18 +55,10 @@ void WorkspaceModel::remove(Workspace *workspace)
55 beginRemoveRows(QModelIndex(), index, index);
55 beginRemoveRows(QModelIndex(), index, index);
56
56
57 m_workspaces.removeAt(index);
57 m_workspaces.removeAt(index);
58+ insertUnassigned(workspace);
58
59
59 endRemoveRows();
60 endRemoveRows();
60
61
61− m_unassignedWorkspaces.insert(workspace);
62− connect(workspace, &Workspace::assigned, this, [=]() {
63− m_unassignedWorkspaces.remove(workspace);
64− disconnect(workspace, &Workspace::assigned, this, 0);
65− });
66− connect(workspace, &QObject::destroyed, this, [=]() {
67− m_unassignedWorkspaces.remove(workspace);
68− });
69−
70 Q_EMIT workspaceRemoved(workspace);
62 Q_EMIT workspaceRemoved(workspace);
71 Q_EMIT countChanged();
63 Q_EMIT countChanged();
72}
64}
@@ -195,6 +187,19 @@ void WorkspaceModel::finishSync()
195 m_unassignedWorkspaces.clear();
187 m_unassignedWorkspaces.clear();
196}
188}
197
189
190+void WorkspaceModel::insertUnassigned(Workspace *workspace)
191+{
192+ m_unassignedWorkspaces.insert(workspace);
193+ connect(workspace, &Workspace::assigned, this, [=]() {
194+ m_unassignedWorkspaces.remove(workspace);
195+ disconnect(workspace, &Workspace::assigned, this, 0);
196+ });
197+ connect(workspace, &QObject::destroyed, this, [=]() {
198+ m_unassignedWorkspaces.remove(workspace);
199+ });
200+}
201+
202+
198ProxyWorkspaceModel::ProxyWorkspaceModel(WorkspaceModel * const model)
203ProxyWorkspaceModel::ProxyWorkspaceModel(WorkspaceModel * const model)
199 : m_original(model)
204 : m_original(model)
200{
205{
@@ -241,7 +246,7 @@ void ProxyWorkspaceModel::move(int from, int to)
241void ProxyWorkspaceModel::addWorkspace()
246void ProxyWorkspaceModel::addWorkspace()
242{
247{
243 auto newWorkspace = WorkspaceManager::instance()->createWorkspace();
248 auto newWorkspace = WorkspaceManager::instance()->createWorkspace();
244− m_original->m_unassignedWorkspaces.insert(newWorkspace);
249+ m_original->insertUnassigned(newWorkspace);
245
250
246 (new ProxyWorkspace(newWorkspace))->assign(this);
251 (new ProxyWorkspace(newWorkspace))->assign(this);
247}
252}
plugins/WindowManager/WorkspaceModel.h+2
@@ -74,6 +74,8 @@ Q_SIGNALS:
74 void workspaceMoved(int from, int to);
74 void workspaceMoved(int from, int to);
75
75
76protected:
76protected:
77+ void insertUnassigned(Workspace* workspace);
78+
77 QVector<Workspace*> m_workspaces;
79 QVector<Workspace*> m_workspaces;
78 QSet<Workspace*> m_unassignedWorkspaces;
80 QSet<Workspace*> m_unassignedWorkspaces;
79 bool m_syncing;
81 bool m_syncing;