Skip to content

Commit

Permalink
fix: crash when saving avatar
Browse files Browse the repository at this point in the history
change Type::Cartoon to Type::Dimensional

pms: BUG-295675
  • Loading branch information
FeiWang1119 authored and deepin-bot[bot] committed Dec 24, 2024
1 parent cf91e97 commit eaac1e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dcc-old/src/plugin-accounts/window/avatarlistframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 4 additions & 5 deletions dcc-old/src/plugin-accounts/window/avatarlistwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down Expand Up @@ -204,18 +204,17 @@ 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);
});

connect(saveButton, &QPushButton::clicked, this, [this]() {
const QString path = getAvatarPath();
if (!path.isEmpty() && path != m_curUser->currentAvatar()) {
m_path = path;

// 成功设置头像后关闭窗口
accept();
}
// 成功设置头像后关闭窗口
accept();
});
connect(cancelButton, &QPushButton::clicked, this, &QDialog::reject);

Expand Down

0 comments on commit eaac1e6

Please sign in to comment.