mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-06 13:33:55 -07:00
[Game] Fix crash by properly parenting QObjects
This commit is contained in:
parent
dbed6890da
commit
5e3d43dcbd
5 changed files with 7 additions and 5 deletions
|
|
@ -1,8 +1,9 @@
|
||||||
#include "abstract_game.h"
|
#include "abstract_game.h"
|
||||||
|
|
||||||
|
#include "../interface/widgets/tabs/tab_game.h"
|
||||||
#include "player/player.h"
|
#include "player/player.h"
|
||||||
|
|
||||||
AbstractGame::AbstractGame(TabGame *_tab) : tab(_tab)
|
AbstractGame::AbstractGame(TabGame *_tab) : QObject(_tab), tab(_tab)
|
||||||
{
|
{
|
||||||
gameMetaInfo = new GameMetaInfo(this);
|
gameMetaInfo = new GameMetaInfo(this);
|
||||||
gameEventHandler = new GameEventHandler(this);
|
gameEventHandler = new GameEventHandler(this);
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
#include <libcockatrice/protocol/pb/command_reveal_cards.pb.h>
|
#include <libcockatrice/protocol/pb/command_reveal_cards.pb.h>
|
||||||
|
|
||||||
PlayerMenu::PlayerMenu(Player *_player) : player(_player)
|
PlayerMenu::PlayerMenu(Player *_player) : QObject(_player), player(_player)
|
||||||
{
|
{
|
||||||
playerMenu = new TearOffMenu();
|
playerMenu = new TearOffMenu();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ private slots:
|
||||||
void refreshShortcuts();
|
void refreshShortcuts();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PlayerMenu(Player *player);
|
explicit PlayerMenu(Player *player);
|
||||||
/// Lifecycle methods: delegate to all managedComponents, plus counters separately via player->getCounters().
|
/// Lifecycle methods: delegate to all managedComponents, plus counters separately via player->getCounters().
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,8 @@
|
||||||
// milliseconds in between triggers of the move top cards until action
|
// milliseconds in between triggers of the move top cards until action
|
||||||
static constexpr int MOVE_TOP_CARD_UNTIL_INTERVAL = 100;
|
static constexpr int MOVE_TOP_CARD_UNTIL_INTERVAL = 100;
|
||||||
|
|
||||||
PlayerActions::PlayerActions(Player *_player) : player(_player), lastTokenTableRow(0), movingCardsUntil(false)
|
PlayerActions::PlayerActions(Player *_player)
|
||||||
|
: QObject(_player), player(_player), lastTokenTableRow(0), movingCardsUntil(false)
|
||||||
{
|
{
|
||||||
moveTopCardTimer = new QTimer(this);
|
moveTopCardTimer = new QTimer(this);
|
||||||
moveTopCardTimer->setInterval(MOVE_TOP_CARD_UNTIL_INTERVAL);
|
moveTopCardTimer->setInterval(MOVE_TOP_CARD_UNTIL_INTERVAL);
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
#include <libcockatrice/protocol/pb/event_shuffle.pb.h>
|
#include <libcockatrice/protocol/pb/event_shuffle.pb.h>
|
||||||
#include <libcockatrice/utility/zone_names.h>
|
#include <libcockatrice/utility/zone_names.h>
|
||||||
|
|
||||||
PlayerEventHandler::PlayerEventHandler(Player *_player) : player(_player)
|
PlayerEventHandler::PlayerEventHandler(Player *_player) : QObject(_player), player(_player)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue