[Kde-games-devel] Review Request 119436: fix for bug #335017: konquest emits warning "QStateMachine::addState: state has already been added to this machine" when starting a new game

Martin Walch walch.martin at web.de
Sun Aug 10 16:28:35 UTC 2014



> On Aug. 10, 2014, 3:20 nachm., Nemanja Hirsl wrote:
> > localgame.cpp, line 61
> > <https://git.reviewboard.kde.org/r/119436/diff/1-2/?file=292214#file292214line61>
> >
> >     I can't find addPlayer in the Player c-tor...
> >     There is QState(&(game->m_gameMachine)); so the comment might be somewhat missleading.
> >     
> >     According to the documentation: http://qt-project.org/doc/qt-4.8/qstate.html "Top-level states must be passed a QStateMachine object as their parent state, or added to a state machine using QStateMachine::addState()."
> >     Is this our case?
> >     
> >     I've applied the patch and couldn't notice any difference in gameplay.

Sorry, my bad. The comment was just wrong. Should be correct now.

> Is this our case?

Yes, m_gameMachine is the parent of each Player object.


- Martin


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/119436/#review64178
-----------------------------------------------------------


On Aug. 10, 2014, 4:25 nachm., Martin Walch wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/119436/
> -----------------------------------------------------------
> 
> (Updated Aug. 10, 2014, 4:25 nachm.)
> 
> 
> Review request for KDE Games, Alexander Schuch and Nemanja Hirsl.
> 
> 
> Bugs: 335017
>     http://bugs.kde.org/show_bug.cgi?id=335017
> 
> 
> Repository: konquest
> 
> 
> Description
> -------
> 
> 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
> 
> 
> Diffs
> -----
> 
>   localgame.cpp a98e2f5 
> 
> Diff: https://git.reviewboard.kde.org/r/119436/diff/
> 
> 
> Testing
> -------
> 
> 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.
> 
> 
> Thanks,
> 
> Martin Walch
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-games-devel/attachments/20140810/fecb3714/attachment.html>


More information about the kde-games-devel mailing list