Race condition in Tk interface

Bug #309106 reported by David Soulayrol on 2008-12-17
Affects Status Importance Assigned to Milestone
David Soulayrol

Bug Description

Sometimes, the following exception is raised, not handled, and leads to game interruption.

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.5/lib-tk/Tkinter.py", line 1417, in __call__
    return self.func(*args)
  File "/usr/lib/python2.5/lib-tk/Tkinter.py", line 501, in callit
  File "/home/david/src/duo/duo/ui/tk.py", line 878, in _poll_canvas_events
    callable_(*args, **keys)
  File "/home/david/src/duo/duo/ui/tk.py", line 783, in play_card
AttributeError: 'NoneType' object has no attribute 'play'

What happens is that refresh_cards and on_heap_cb (from the Player class) are run simultaneously in two different threads, and the _hand attribute is not protected against this. So the player hand is empty when searched for the card that was played (in on_heap_cb), and play_card is called with None as card parameter.

Changed in duo:
assignee: nobody → dsoulayrol
importance: Undecided → High
status: New → Confirmed
Changed in duo:
status: Confirmed → Fix Committed
milestone: none → 0.9

Released in 0.9

Changed in duo:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers