Skip to content

Commit ea86bef

Browse files
committed
Fixed redundant processing issue
Fixed a redundant processing issue that could cause memory leaks. Now TaskGuard checks if the auto_save() function has been started. Previously, the program created a connect() each time items were selected.
1 parent 0f5e82b commit ea86bef

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

src/mainwindow.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1087,7 +1087,8 @@ void MainWindow::on_task_item_clicked(QListWidgetItem *item) {
10871087

10881088
if (db_show_task(task_id)) {
10891089
m_task_current_id = task_id;
1090-
auto_save();
1090+
1091+
if (auto_save_status == false) auto_save();
10911092

10921093
ui->task_title->setCursorPosition(0);
10931094
ui->task_view_frame->show();
@@ -1164,6 +1165,8 @@ void MainWindow::auto_save() {
11641165

11651166
});
11661167

1168+
auto_save_status = true;
1169+
11671170
}
11681171

11691172
QVector<QMap<QString, QVariant>> MainWindow::get_task_data_by_id(unsigned int task_id) {

src/mainwindow.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ private slots:
197197
QString g_db_password;
198198
bool use_encryption = false;
199199
bool use_hwid = false;
200+
201+
bool auto_save_status = false;
200202
};
201203

202204
#endif // MAINWINDOW_H

0 commit comments

Comments
 (0)