From 2bb058d6d73a8912dbb7dc7ca82dc9709c910a2d Mon Sep 17 00:00:00 2001 From: wangfei Date: Wed, 18 Dec 2024 14:51:15 +0800 Subject: [PATCH] fix: crash when saving avatar change Type::Cartoon to Type::Dimensional pms: BUG-295675 --- dcc-old/src/plugin-accounts/window/avatarlistframe.cpp | 2 +- dcc-old/src/plugin-accounts/window/avatarlistwidget.cpp | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/dcc-old/src/plugin-accounts/window/avatarlistframe.cpp b/dcc-old/src/plugin-accounts/window/avatarlistframe.cpp index 290040632b..4cffcaf2d1 100644 --- a/dcc-old/src/plugin-accounts/window/avatarlistframe.cpp +++ b/dcc-old/src/plugin-accounts/window/avatarlistframe.cpp @@ -174,7 +174,7 @@ AvatarListFrame::AvatarListFrame(User * user, const int &role, QWidget *parent) setLayout(layout); - m_currentAvatarLsv = m_avatarViewMap.value(Type::Cartoon); + m_currentAvatarLsv = m_avatarViewMap.value(Type::Dimensional); } QString AvatarListFrame::getAvatarPath() const diff --git a/dcc-old/src/plugin-accounts/window/avatarlistwidget.cpp b/dcc-old/src/plugin-accounts/window/avatarlistwidget.cpp index 27e811beae..f2e0446174 100644 --- a/dcc-old/src/plugin-accounts/window/avatarlistwidget.cpp +++ b/dcc-old/src/plugin-accounts/window/avatarlistwidget.cpp @@ -164,7 +164,7 @@ AvatarListDialog::AvatarListDialog(User *usr, AccountsWorker *worker, QWidget *p } // 切换到自定义头像界面, 更新用户头像编辑页面 - if (index.row() == 4) { + if (index.row() == Custom) { getCustomAvatarWidget()->getCustomAvatarView()->setAvatarPath( m_avatarFrames[Custom]->getCurrentListView()->getAvatarPath()); } @@ -204,7 +204,7 @@ AvatarListDialog::AvatarListDialog(User *usr, AccountsWorker *worker, QWidget *p this, [avatarSelectWidget, this](const QString &path) { m_currentSelectAvatarWidget = m_avatarFrames[Custom]; - avatarSelectWidget->setCurrentIndex(4); + avatarSelectWidget->setCurrentIndex(Custom); m_currentSelectAvatarWidget->getCurrentListView()->requestAddCustomAvatar(path); }); @@ -212,10 +212,9 @@ AvatarListDialog::AvatarListDialog(User *usr, AccountsWorker *worker, QWidget *p const QString path = getAvatarPath(); if (!path.isEmpty() && path != m_curUser->currentAvatar()) { m_path = path; - - // 成功设置头像后关闭窗口 - accept(); } + // 成功设置头像后关闭窗口 + accept(); }); connect(cancelButton, &QPushButton::clicked, this, &QDialog::reject);