Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve 2 memory leaks #311

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions deepin-system-monitor-main/model/accounts_info_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,13 @@
this, SLOT(onSessionNew(QString, QDBusObjectPath)));
}

AccountsInfoModel::~AccountsInfoModel()
{
qDeleteAll(m_userMap.values());
m_userMap.clear();
}

void AccountsInfoModel::onUserListChanged(const QStringList &userPathList)

Check warning on line 52 in deepin-system-monitor-main/model/accounts_info_model.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'onUserListChanged' is never used.
{
updateUserList(userPathList);
qInfo() << "get update:" << userPathList;
Expand Down
1 change: 1 addition & 0 deletions deepin-system-monitor-main/model/accounts_info_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class AccountsInfoModel : public QObject

public:
explicit AccountsInfoModel(QObject *parent = nullptr);
virtual ~AccountsInfoModel();
void updateUserList(const QStringList &userPathList);
QList<User *> userList() const;
User::UserType getCurrentUserType() const;
Expand Down
10 changes: 5 additions & 5 deletions deepin-system-monitor-main/process/process_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ void ProcessSet::scanProcess()

for (const pid_t &pid : m_curPid) {
if(!m_prePid.contains(pid)){ //add new process pid
Process *proc = new Process(pid);
proc->readProcessSimpleInfo();
Process proc(pid);
proc.readProcessSimpleInfo();
if(!m_simpleSet.contains(pid))
m_simpleSet.insert(proc->pid(), *proc);
m_simpleSet.insert(proc.pid(), proc);

if (proc->appType() == kFilterApps && !wmwindowList->isTrayApp(proc->pid())) {
m_pidMyApps << proc->pid();
if (proc.appType() == kFilterApps && !wmwindowList->isTrayApp(proc.pid())) {
m_pidMyApps << proc.pid();
}
}
}
Expand Down
Loading