From cff16346ef45b26a7c60b5b8c7674f911fb39a76 Mon Sep 17 00:00:00 2001 From: BruebachL <44814898+BruebachL@users.noreply.github.com> Date: Sat, 4 Oct 2025 01:08:04 +0200 Subject: [PATCH 1/3] [TabGame] Fix dangling PlayerMenus in gameMenu (#6215) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Player manager is responsible for deleting players. Took 21 minutes * Clean up dangling QAction* wrappers for PlayerMenus in TabGame::processPlayerLeave(Player* leavingPlayer) Took 37 seconds * Lint. Took 11 minutes --------- Co-authored-by: Lukas BrĂ¼bach --- cockatrice/src/game/player/player_manager.cpp | 1 + cockatrice/src/tabs/tab_game.cpp | 33 ++++++++++++++----- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/cockatrice/src/game/player/player_manager.cpp b/cockatrice/src/game/player/player_manager.cpp index d8c12cee6..e283d2196 100644 --- a/cockatrice/src/game/player/player_manager.cpp +++ b/cockatrice/src/game/player/player_manager.cpp @@ -60,6 +60,7 @@ void PlayerManager::removePlayer(int playerId) emit playerRemoved(player); emit playerCountChanged(); players.remove(playerId); + player->deleteLater(); } Player *PlayerManager::getPlayer(int playerId) const diff --git a/cockatrice/src/tabs/tab_game.cpp b/cockatrice/src/tabs/tab_game.cpp index a07430dbb..c31f548d6 100644 --- a/cockatrice/src/tabs/tab_game.cpp +++ b/cockatrice/src/tabs/tab_game.cpp @@ -650,14 +650,6 @@ void TabGame::notifyPlayerKicked() msgBox.exec(); } -void TabGame::processPlayerLeave(Player *leavingPlayer) -{ - QString playerName = "@" + leavingPlayer->getPlayerInfo()->getName(); - removePlayerFromAutoCompleteList(playerName); - - scene->removePlayer(leavingPlayer); -} - Player *TabGame::addPlayer(Player *newPlayer) { QString newPlayerName = "@" + newPlayer->getPlayerInfo()->getName(); @@ -707,6 +699,31 @@ void TabGame::addLocalPlayer(Player *newPlayer, int playerId) } } +void TabGame::processPlayerLeave(Player *leavingPlayer) +{ + QString playerName = "@" + leavingPlayer->getPlayerInfo()->getName(); + removePlayerFromAutoCompleteList(playerName); + + scene->removePlayer(leavingPlayer); + + // When we inserted the playerMenu into the gameMenu earlier, Qt wrapped the playerMenu into a QAction*, which lives + // independently and does not get cleaned up when the source menu gets destroyed. We have to manually clean here. + if (leavingPlayer->getPlayerMenu()) { + QMenu *menu = leavingPlayer->getPlayerMenu()->getPlayerMenu(); + if (menu) { + // Find and remove the QAction pointing to this menu + QList actions = gameMenu->actions(); + for (QAction *act : actions) { + if (act->menu() == menu) { + gameMenu->removeAction(act); + delete act; // deletes the QAction wrapper around the submenu + break; + } + } + } + } +} + void TabGame::processRemotePlayerDeckSelect(QString deckList, int playerId, QString playerName) { DeckList loader; From 9c58e6f90f4d009e35f4ad791a0d2e97fe2373ec Mon Sep 17 00:00:00 2001 From: RickyRister <42636155+RickyRister@users.noreply.github.com> Date: Sun, 5 Oct 2025 04:31:46 -0700 Subject: [PATCH 2/3] Don't use vcpkg on local macOS (#6225) * Don't use vcpkg on local macOS * fix typo --- .ci/compile.sh | 7 +++++++ .github/workflows/desktop-build.yml | 2 +- CMakeLists.txt | 6 ++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.ci/compile.sh b/.ci/compile.sh index 2938e0902..7b0f593e9 100755 --- a/.ci/compile.sh +++ b/.ci/compile.sh @@ -66,6 +66,10 @@ while [[ $# != 0 ]]; do shift fi ;; + '--vcpkg') + USE_VCPKG=1 + shift + ;; '--dir') shift if [[ $# == 0 ]]; then @@ -116,6 +120,9 @@ fi if [[ $PACKAGE_TYPE ]]; then flags+=("-DCPACK_GENERATOR=$PACKAGE_TYPE") fi +if [[ $USE_VCPKG ]]; then + flags+=("-DUSE_VCPKG=1") +fi # Add cmake --build flags buildflags=(--config "$BUILDTYPE") diff --git a/.github/workflows/desktop-build.yml b/.github/workflows/desktop-build.yml index b1afcbfa5..88d3f352b 100644 --- a/.github/workflows/desktop-build.yml +++ b/.github/workflows/desktop-build.yml @@ -318,7 +318,7 @@ jobs: CMAKE_GENERATOR: '${{env.CMAKE_GENERATOR}}' VCPKG_DISABLE_METRICS: 1 VCPKG_BINARY_SOURCES: 'clear;files,${{ steps.vcpkg-cache.outputs.path }},readwrite' - run: .ci/compile.sh --server --test --ccache "$CCACHE_SIZE" + run: .ci/compile.sh --server --test --ccache "$CCACHE_SIZE" --vcpkg - name: Sign app bundle if: matrix.make_package && (github.ref == 'refs/heads/master' || needs.configure.outputs.tag != null) diff --git a/CMakeLists.txt b/CMakeLists.txt index 34afff90b..4d2e4b145 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,8 @@ option(WITH_ORACLE "build oracle" ON) option(WITH_DBCONVERTER "build dbconverter" ON) # Compile tests option(TEST "build tests" OFF) +# Use vcpkg regardless of OS +option(USE_VCPKG "Use vcpkg regardless of OS" OFF) # Default to "Release" build type # User-provided value for CMAKE_BUILD_TYPE must be checked before the PROJECT() call @@ -48,8 +50,8 @@ if(USE_CCACHE) endif() endif() -if(WIN32 OR APPLE) - # Use vcpkg toolchain on Windows and macOS +if(WIN32 OR USE_VCPKG) + # Use vcpkg toolchain on Windows (and on macOS in CI) set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake CACHE STRING "Vcpkg toolchain file" From c25b153185037e350ec949a74aae118cdc668ca0 Mon Sep 17 00:00:00 2001 From: tooomm Date: Sun, 5 Oct 2025 16:51:06 +0200 Subject: [PATCH 3/3] CI: Update trigger paths for desktop workflows (#6223) * update trigger paths * change to include paths trigger pattern * refine selection --- .github/workflows/desktop-build.yml | 33 +++++++++++++++++++---------- .github/workflows/desktop-lint.yml | 20 +++++++++++------ 2 files changed, 36 insertions(+), 17 deletions(-) diff --git a/.github/workflows/desktop-build.yml b/.github/workflows/desktop-build.yml index 88d3f352b..ecacaf4d1 100644 --- a/.github/workflows/desktop-build.yml +++ b/.github/workflows/desktop-build.yml @@ -9,20 +9,31 @@ on: push: branches: - master - paths-ignore: - - '**.md' - - 'webclient/**' - - '.github/workflows/web-*.yml' - - '.github/workflows/translations-*.yml' - - '.github/workflows/docker-release.yml' + paths: + - '*/**' # matches all files not in root + - '!**.md' + - '!.github/**' + - '!.husky/**' + - '!.tx/**' + - '!doc/**' + - '!webclient/**' + - '.github/workflows/desktop-build.yml' + - 'CMakeLists.txt' + - 'vcpkg.json' tags: - '*' pull_request: - paths-ignore: - - '**.md' - - 'webclient/**' - - '.github/workflows/web-*.yml' - - '.github/workflows/translations-*.yml' + paths: + - '*/**' # matches all files not in root + - '!**.md' + - '!.github/**' + - '!.husky/**' + - '!.tx/**' + - '!doc/**' + - '!webclient/**' + - '.github/workflows/desktop-build.yml' + - 'CMakeLists.txt' + - 'vcpkg.json' # Cancel earlier, unfinished runs of this workflow on the same branch (unless on master) concurrency: diff --git a/.github/workflows/desktop-lint.yml b/.github/workflows/desktop-lint.yml index 39b68eb72..b8c015c16 100644 --- a/.github/workflows/desktop-lint.yml +++ b/.github/workflows/desktop-lint.yml @@ -2,12 +2,20 @@ name: Code Style (C++) on: pull_request: - paths-ignore: - - '**.md' - - 'webclient/**' - - '.github/workflows/web-*.yml' - - '.github/workflows/translations-*.yml' - - '.github/workflows/docker-release.yml' + paths: + - '*/**' # matches all files not in root + - '!**.md' + - '!.ci/**' + - '!.github/**' + - '!.husky' + - '!.tx' + - '!doc/**' + - '!webclient/**' + - '.github/workflows/desktop-lint.yml' + - '.ci/lint_cpp.sh' + - '.clang-format' + - '.cmake-format.json' + - 'format.sh' jobs: format: