Project: titanium
Issue TIMOB-18724: Windows::HTTPClient crashes on firing onreadystatechange after being GCed
When running the mocha tests, I'm seeing some bad behavior from HTTPclient. We fire off requests in tests and continue on and eventually in a a later test (typically the layout suite) we'll get an error stemming from the HTTPClient firing an onreadystatechange callback: {code} Unhandled exception at 0x6B83D4C6 (HAL.dll) in NMocha.exe: 0xC0000005: Access violation reading location 0xDDDDDDDD. {code} It's in HTTPClient::onreadystatechange in Titaniumkit, where it's testing if the callback is a function. The issue is likely because we've long moved on from the test where the httpclient was generated - I'm thinking maybe it was GCed and we didn't properly cancel and clean up in our destructor. The request was continuing in an async chain. My best guess is that we need to cancel all outstanding requests when the Windows impl desturctor hits, and null out the callback objects up in the TitaniumKit destructor?
Story points: 5