Skip to content

Commit 740630f

Browse files
committed
fix: disconnect lineEdit in AuthPassword destructor
1. Added disconnect call for m_lineEdit from this object in destructor 2. Prevents potential lambda function access to deleted this pointer 3. Ensures clean signal-slot disconnection during object destruction 4. Avoids use-after-free crashes when signals are emitted after object deletion Influence: 1. Test password authentication widget destruction scenarios 2. Verify no crashes when closing authentication dialogs 3. Test signal emission handling during widget lifecycle 4. Validate memory safety in authentication flow fix: 在AuthPassword析构函数中断开lineEdit连接 1. 在析构函数中添加了m_lineEdit与当前对象的断开连接调用 2. 防止lambda函数访问已删除的this指针 3. 确保对象销毁时信号槽连接的清理 4. 避免对象删除后信号发射导致的use-after-free崩溃 Influence: 1. 测试密码认证小部件的销毁场景 2. 验证关闭认证对话框时不会出现崩溃 3. 测试小部件生命周期中的信号发射处理 4. 验证认证流程中的内存安全性 pms: BUG-341127
1 parent 1fabba7 commit 740630f

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/session-widgets/auth_password.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ AuthPassword::AuthPassword(QWidget *parent)
7575

7676
AuthPassword::~AuthPassword()
7777
{
78+
// QWidget析构时会clearFocus, focusChanged会被触发,且槽函数操作了成员变量会导致崩溃,在这里提前断开连接
79+
m_lineEdit->disconnect(this);
7880
if (m_resetPasswordMessageVisible) {
7981
closeResetPasswordMessage();
8082
}

0 commit comments

Comments
 (0)