It looks like there's a synchronisation bug with savefiles.
Numbered Steps to Reproduce Problem:
1. We're creating a savefile object using new/savefile("file.sav").
2. We enter a for loop which loops over a group of turfs (previously obtained with the block() proc).
3. As this is going to be CPU-intensive we periodically call sleep() so the server remains responsive.
4. At some point the variable that had a reference to the savefile object is reset to null.
5. Proc crashes because it attempts to set savefile.cd to something, but since the variable is now null it can't do this.
Code Snippet (if applicable) to Reproduce Problem:
mob/Login()
spawn test()
spawn
var/savefile/F = new("savefile.sav")
F.Lock()
sleep(20)
world << "F = [F]" // F = <null>
proc/test()
var/savefile/F = new("savefile.sav")
sleep(10)
fdel("savefile.sav") // ignores the lock and dereferences the savefile
Expected Results:
fdel should return false because the file is locked. (The developer should wrap this in a try/catch statement.)
Actual Results:
The file is deleted and the savefile dereferenced, leading to errors elsewhere.
Does the problem occur:
Every time? Or how often?
I've got a reproducible case
In other games?
In other user accounts?
Untested.
On other computers?
Untested.
When does the problem NOT occur?
The problem only occurs when fdel is used on a savefile, so there's a viable workaround by checking if you have a savefile open.
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
Unknown.
Workarounds:
Manually check if you have "locked" a savefile when using fdel.