> The difference is, there are a time race between icon reading, > > and displaying, at times, as the file is a tempfile, > > at the moment of display was already deleted. > > Is the code deleting the file? Otherwise who deletes it? > > In /etc/fstab I see the line: > > /tmp /tmp tmpfs rw,size=50m 0 0 > > So unless /tmp is filled by 50 megas of files or the XO is rebooted, > the icon should stay there, no? >
It's a tempfile [1] then python delete it magically after closed. See ActivityBundle.get_icon() In fact the code have a comment: # FIXME: this should return the icon data, not a filename, so that # we don't need to create a temp file in the zip case And we are returning util.TempFilePath, where there are code to delete pending files if needed. I think in this case, the proper solution is get the icon data (adding a method get_icon_data) and put it in the listmodel. (Only for the .xo cases) In the meantime, have the icons cached in a directory is no so bad. Maybe we can do it in /tmp/ to get it deleted at startup without need more [1] http://docs.python.org/2/library/tempfile.html
_______________________________________________ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel