HandleURL HTTP Threads Stick Around

I create a new standalone web app, create a HandleURL event handler, then add this code:

Return true

Press run then close the webpage immediately.
I have waited about 10 minutes and the HTTP thread is still there when I pause the app.

This doesn’t happen when I leave the webpage open.

Is there a way to manually kill it after I call return?


I played around a little bit and I found a hack to get it to work:

HandleURL Event:

Function HandleURL(Request As WebRequest) As Boolean
    xojo.Core.Timer.CallLater(5000, AddressOf KillThread, App.CurrentThread)
    Return True
  end if
End Function

App.KillThread Method:

Sub KillThread(A as Auto)
  dim T as Thread = A
End Sub

It looks like it works, (5000 is the timeout for lost connections) I’m just wondering if there’s a better way.

Also, I think this could go horribly wrong if it finds the main thread for some reason.