ID:1461346
 
Not a bug
BYOND Version:503
Operating System:Windows XP Home
Web Browser:Chrome 31.0.1650.63
Applies to:Dream Maker
Status: Not a bug

This is not a bug. It may be an incorrect use of syntax or a limitation in the software. For further discussion on the matter, please consult the BYOND forums.
SOLUTION:
You have to create an object that creates an object that sleeps, then delete the object that sleeps via the first object, and sleeping cannot be done in New()

So you can't create a single object then delete it elsewhere to stop the sleeping.

Descriptive Problem Summary:
The DM reference says that if the source of a procedure that calls sleep is deleted, then termination stops immediately.

The DM guide lies
Numbered Steps to Reproduce Problem:
1.)Sleep
2.)delete object that called sleep
3.)not wat i want
Code Snippet (if applicable) to Reproduce Problem:

var/obj/test/test
client
Click()
del test
mob
verb
test()



test = new
world<<"Pie"
obj
test
New()
..()
sleep(9000)


Expected Results:
INSTANTLY BAKED PIE!
Actual Results:
BURNT PIE! (not instantly baked)
Does the problem occur:
Every time? Or how often? Every time
In other games? Wot
In other user accounts? ya
On other computers? si

When does the problem NOT occur?
never :(
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.)

It worked in earlier versions, prior to 5.0. I'm gonna guess it has something to do with that new fangled threading thing you have going on (fancy stuff) but I can't be certain.

Workarounds:
while(object)
sleep(1)
I honestly can't make head or tails out of what you're saying. Please clarify.
Alright, in all seriousness, the DM reference reads:
Sleep:
Also be aware, that a sleeping procedure whose src object gets deleted will automatically terminate when execution returns to it. This is to protect you against trying to access properties or procedures of a deleted (and therefore null) object. If you do not want the procedure to be terminated, you should set src to null.


Basically, if I delete an object that called sleep, the execution of sleep should end. But it doesn't, it continues to sleep until execution is finished.

So, I'm pretty sure Garthor's getClick library is broken, because it was based on that
Stephen001 resolved issue (Not a bug)