Browse Source

update: release page when changed

YaoH 3 weeks ago
parent
commit
ecb506b18a
1 changed files with 1 additions and 0 deletions
  1. 1 0
      mainwindow.cpp

+ 1 - 0
mainwindow.cpp

@@ -120,6 +120,7 @@ void MainWindow::switchPage(QWidget *button) {
             existingPage->hide();
             ui->stackedWidget->removeWidget(existingPage);
             createdPageByButton.remove(button);
+            delete existingPage;  // 删除旧页面
         }
 
         QWidget *newPage = factory->createPage(this);