Skip to content

Commit ceaea6a

Browse files
18202781743deepin-bot[bot]
authored andcommitted
fix: prevent window blur loss on destruction in treeland platform
1. Added destructor cleanup for PersonalizationWindowContext, PersonalizationAppearanceContext, and PersonalizationFontContext to properly destroy wayland protocol objects 2. Added deferred deletion of m_windowContext in DTreeLandPlatformWindowHelper destructor to prevent dangling pointer access 3. Fixed the intermittent window blur loss issue by ensuring wayland objects are properly cleaned up before the parent window is removed from the window map Log: Fixed intermittent window blur loss issue in treeland Influence: 1. Test window creation and destruction with blur effects enabled 2. Verify window blur effect persists during normal usage 3. Test rapid window open/close cycles to reproduce the intermittent blur loss 4. Verify no crashes or memory leaks when windows are destroyed 5. Test on treeland platform with multiple windows and frequent window operations fix: 修复treeland平台上窗口销毁时模糊效果丢失问题 1. 为PersonalizationWindowContext、PersonalizationAppearanceContext和 PersonalizationFontContext添加析构函数,确保正确销毁wayland协议对象 2. 在DTreeLandPlatformWindowHelper析构函数中添加m_windowContext的延迟删 除,防止悬空指针访问 3. 通过在从窗口映射表中移除父窗口前清理wayland对象,修复间歇性窗口模糊丢 失问题 Log: 修复treeland平台上窗口模糊偶现丢失问题 Influence: 1. 测试开启模糊效果时的窗口创建和销毁 2. 验证正常使用时窗口模糊效果持续保持 3. 测试快速打开/关闭窗口循环以重现间歇性模糊丢失问题 4. 验证窗口销毁时无崩溃或内存泄漏 5. 在treeland平台上使用多个窗口和频繁窗口操作进行测试 PMS: BUG-345489
1 parent 93b8639 commit ceaea6a

3 files changed

Lines changed: 27 additions & 3 deletions

File tree

src/plugins/platform/treeland/dtreelandplatformwindowinterface.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,10 @@ DTreeLandPlatformWindowHelper::DTreeLandPlatformWindowHelper(QWindow *window)
220220

221221
DTreeLandPlatformWindowHelper::~DTreeLandPlatformWindowHelper()
222222
{
223-
// see tst_qwindow.cpp tst_QWindow::qobject_castOnDestruction()
223+
if (m_windowContext) {
224+
m_windowContext->deleteLater();
225+
m_windowContext = nullptr;
226+
}
224227
windowMap.remove(static_cast<QWindow*>(parent()));
225228
}
226229

src/plugins/platform/treeland/personalizationwaylandclientextension.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
1+
// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd.
22
//
33
// SPDX-License-Identifier: LGPL-3.0-or-later
44

@@ -73,6 +73,18 @@ PersonalizationWindowContext::PersonalizationWindowContext(struct ::treeland_per
7373

7474
}
7575

76+
PersonalizationWindowContext::~PersonalizationWindowContext()
77+
{
78+
if (isInitialized())
79+
destroy();
80+
}
81+
82+
PersonalizationAppearanceContext::~PersonalizationAppearanceContext()
83+
{
84+
if (isInitialized())
85+
destroy();
86+
}
87+
7688
PersonalizationAppearanceContext::PersonalizationAppearanceContext(struct ::treeland_personalization_appearance_context_v1 *context, DTreelandPlatformInterface *interface)
7789
: QWaylandClientExtensionTemplate<PersonalizationAppearanceContext>(treeland_personalization_appearance_context_v1_interface.version)
7890
, QtWayland::treeland_personalization_appearance_context_v1(context)
@@ -118,6 +130,12 @@ void PersonalizationAppearanceContext::treeland_personalization_appearance_conte
118130
m_interface->m_blurOpacity = opacity;
119131
}
120132

133+
PersonalizationFontContext::~PersonalizationFontContext()
134+
{
135+
if (isInitialized())
136+
destroy();
137+
}
138+
121139
PersonalizationFontContext::PersonalizationFontContext(struct ::treeland_personalization_font_context_v1 *context, DTreelandPlatformInterface *interface)
122140
: QWaylandClientExtensionTemplate<PersonalizationFontContext>(treeland_personalization_font_context_v1_interface.version)
123141
, QtWayland::treeland_personalization_font_context_v1(context)

src/plugins/platform/treeland/personalizationwaylandclientextension.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
1+
// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd.
22
//
33
// SPDX-License-Identifier: LGPL-3.0-or-later
44

@@ -48,6 +48,7 @@ class PersonalizationWindowContext : public QWaylandClientExtensionTemplate<Pers
4848
Q_OBJECT
4949
public:
5050
explicit PersonalizationWindowContext(struct ::treeland_personalization_window_context_v1 *context);
51+
~PersonalizationWindowContext() override;
5152
};
5253

5354
class PersonalizationAppearanceContext : public QWaylandClientExtensionTemplate<PersonalizationAppearanceContext>,
@@ -56,6 +57,7 @@ class PersonalizationAppearanceContext : public QWaylandClientExtensionTemplate<
5657
Q_OBJECT
5758
public:
5859
explicit PersonalizationAppearanceContext(struct ::treeland_personalization_appearance_context_v1 *context, DTreelandPlatformInterface *interface);
60+
~PersonalizationAppearanceContext() override;
5961

6062
protected:
6163
void treeland_personalization_appearance_context_v1_round_corner_radius(int32_t radius) override;
@@ -73,6 +75,7 @@ class PersonalizationFontContext : public QWaylandClientExtensionTemplate<Person
7375
Q_OBJECT
7476
public:
7577
explicit PersonalizationFontContext(struct ::treeland_personalization_font_context_v1 *context, DTreelandPlatformInterface *interface);
78+
~PersonalizationFontContext() override;
7679

7780
protected:
7881
void treeland_personalization_font_context_v1_font(const QString &font_name) override;

0 commit comments

Comments
 (0)