Hi,
If you're using the Singleton Module from the standard library, i
think it must have a flag or something that automatically gets marked
when it first creates the instance object. By setting that instance to
nil, you allow the garbage collector to clean it, however, the flag
being a class member, exists in memory still and remembers that it has
already created the instance. So, allows you to access it, which in
effect passes you a nil, hence the error.
Solution... hmm.... probably you'd like to use a self-brewed singleton
class. Or by adding a resource-cleanup method, that releases all your
images, that can be called by the last mob's destructor. I'd go with
the second, so that your singleton class becomes lean, yet still
exists, when you don't need it.
Mt.