Bug 461683 - every time i finish a game (win or lose) the following error dialog appears.
Summary: every time i finish a game (win or lose) the following error dialog appears.
Status: RESOLVED FIXED
Alias: None
Product: kajongg
Classification: Applications
Component: general (other bugs)
Version First Reported In: 22.08.1
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Wolfgang Rohdewald
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-11 01:42 UTC by sederb
Modified: 2022-11-11 13:48 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
help/about screen (56.92 KB, image/png)
2022-11-11 01:42 UTC, sederb
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sederb 2022-11-11 01:42:01 UTC
Created attachment 153659 [details]
help/about screen

Error for player stephen brede: 
Traceback (most recent call last):
  File "/usr/bin/kajongg", line 187, in <module>
    Internal.app.exec_()
  File "/usr/share/kajongg/dialogs.py", line 152, in clicked
    self.callback(result)
  File "/usr/lib/python3.10/site-packages/twisted/internet/defer.py", line 661, in callback
    self._startRunCallbacks(result)
  File "/usr/lib/python3.10/site-packages/twisted/internet/defer.py", line 763, in _startRunCallbacks
    self._runCallbacks()
--- <exception caught here> ---
  File "/usr/lib/python3.10/site-packages/twisted/internet/defer.py", line 857, in _runCallbacks
    current.result = callback(  # type: ignore[misc]
  File "/usr/share/kajongg/humanclient.py", line 642, in answered
    return Client.readyForHandStart(self, playerNames, rotateWinds) if self.connection else None
  File "/usr/share/kajongg/client.py", line 290, in readyForHandStart
    self.game.prepareHand()
  File "/usr/share/kajongg/game.py", line 876, in prepareHand
    self.wall.build(shuffleFirst=True)
  File "/usr/share/kajongg/uiwall.py", line 319, in build
    uiTile.tile = Tile.unknown
  File "/usr/share/kajongg/uitile.py", line 307, in tile
    assert not self._tile.isKnown or (self._tile.exposed == value.exposed)
builtins.AssertionError: 

SUMMARY
***
If i close the error window I can continue the game. no apparent effect on scores etc.
***


STEPS TO REPRODUCE
1. play kajongg
2. error dialog occurs at end of game
3. 

OBSERVED RESULT
error dialog

EXPECTED RESULT
no error dialog

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora Linux 36 (Xfce) Kernel: Linux 6.0.5-200.fc36.x86_64
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 5.15.6

ADDITIONAL INFORMATION
has occurred ever since installing kajongg about 10 months ago.
annoying as doesn't seem to affect scores or play.
Comment 1 Wolfgang Rohdewald 2022-11-11 13:48:10 UTC
There is a fix in the pipeline for the next version (only on my PC so far). You can apply it manually:

commit 6885135f90c2f65950de7f0d2cb2f39563e086c1
Author: Wolfgang Rohdewald <wolfgang@rohdewald.de>
Date:   Wed Jun 22 19:40:31 2022 +0200

    turning a tile to make it invisible is also legal
    
    used when shuffling for the next hand.
    
    Since when did this not work?

diff --git a/src/uitile.py b/src/uitile.py
index e4122648..aa85d724 100644
--- a/src/uitile.py
+++ b/src/uitile.py
@@ -304,7 +304,7 @@ class UITile(AnimatedMixin, QGraphicsObject, StrMixin):
     def tile(self, value):  # pylint: disable=arguments-differ
         """set tile name and update display"""
         if value is not self._tile:
-            assert not self._tile.isKnown or (self._tile.exposed == value.exposed)
+            assert not self._tile.isKnown or not value.isKnown or (self._tile.exposed == value.exposed)
             self._tile = value
             self.setDrawingOrder() # because known tiles are above unknown tiles
             self.update()