diff --git a/layers.cpp b/layers.cpp index ed12b52232..b8c3aca127 100644 --- a/layers.cpp +++ b/layers.cpp @@ -723,13 +723,11 @@ QList Workspace::xStackingOrder() const void Workspace::updateXStackingOrder() { - x_stacking.clear(); - std::unique_ptr tree{std::move(m_xStackingQueryTree)}; // use our own stacking order, not the X one, as they may differ - foreach (Toplevel * c, stacking_order) - x_stacking.append(c); + x_stacking = stacking_order; - if (tree && !tree->isNull()) { + if (m_xStackingQueryTree && !m_xStackingQueryTree->isNull()) { + std::unique_ptr tree{std::move(m_xStackingQueryTree)}; xcb_window_t *windows = tree->children(); const auto count = tree->data()->children_len; int foundUnmanagedCount = unmanaged.count();