[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

Alexander Schuch aschuch247 at gmail.com
Sat Aug 2 20:53:18 UTC 2014


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



localgame.cpp
<https://git.reviewboard.kde.org/r/119436/#comment44362>

    The patch looks okay and Konquest still works. :)
    
    However, it looks a bit strange that addState() is implicitly executed by "new Player()" whereas addTransition is explicitly executed by "LocalGame::buildMachine()" at a completely different place. But as for the current state of the code, this is nothing to worry about.
    
    But can you please add a comment here stating that "addState" is implicitly run by the constructor of "Player"? This makes navigating the code a bit easier later on.


- Alexander Schuch


On July 30, 2014, 10:31 p.m., Martin Walch wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/119436/
> -----------------------------------------------------------
> 
> (Updated July 30, 2014, 10:31 p.m.)
> 
> 
> 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().
> 
> 
> 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/20140802/6a8fa2cc/attachment.html>


More information about the kde-games-devel mailing list