fix for bug #335017: konquest emits warning "QStateMachine::addState: state has already been added to this machine" when starting a new game

Review Request #119436 - Created July 23, 2014 and submitted

Information
Martin Walch
konquest
335017
Reviewers
Kdegames
aschuch, nhirsl

Back in May I opened bug #335017 and posted this patch there.

When starting a new game, konquest emits a warning

QStateMachine::addState: state has already been added to this machine

for each player. This is because in the constructor of the common Player class, the new object is added to the QStateMachine, and in LocalGame::buildMachine(), they are added again.

To avoid the resulting warning, drop one of the occurrences.

Considering the status quo of the code, we can expect Game().m_gameMachine to be initialized on Game object creation with the intention to never ever overwrite it afterwards. Hence drop the code from LocalGame::buildMachine().

Also leave a hint why m_gameMachine has already its states assigned.

BUG:335017

Applied patch successfully to master, KDE/4.13 and KDE/4.14.
Builds fine. When running the game, I do not see the warning appear anymore.

Issues

  • 0
  • 2
  • 0
  • 2
Description From Last Updated
Martin Walch
Alexander Schuch
Albert Astals Cid
Martin Walch
Nemanja Hirsl
Martin Walch
Nemanja Hirsl
Martin Walch
Review request changed

Status: Closed (submitted)

Loading...