[ python-Bugs-995925 ] method after() and afer_idle() are not thead save

SourceForge.net noreply at sourceforge.net
Thu Jul 22 15:48:54 CEST 2004


Bugs item #995925, was opened at 2004-07-22 15:48
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=995925&group_id=5470

Category: Tkinter
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Tobias Haar (thaar)
Assigned to: Martin v. Löwis (loewis)
Summary: method after() and afer_idle() are not thead save

Initial Comment:
The methods afer() and after_idle() register the
callback function in the list self._tclCommands. This
List is member of the Misc class in the file tkinter.py
and is not protected by a lock. 
So it could be that the thread  access the list by
calling the function after() and to the same time the
tkinter mainloop access the list  by the methode
deletecommand() in the callback function.  The same
problem will occur if the function after() is called by
two theads.

solution: 
Create a lock object and save the list 
self._tclCommands in the methods :

misc.destroy()
misc.deletecommand()
misc._register()

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=995925&group_id=5470


More information about the Python-bugs-list mailing list