Fix crash if context gets unrefd
Review Request #126012 - Created Nov. 9, 2015 and submitted
Context is refcounted (using it's own internal mechanism for whatever
However, when the last ref is deleted it leaves a dangling pointer in
instance(). When a new object is created it returns that.
This unsets our static pointer when deleting the context object
Still loads as before.
LGTM. Best have sebas call the shipit though.
Why it is using manual refcounting I can't recall. IIRC switching to a sharedptr would only require changes to the Context and Ref class though, so that might be a junior job to write down somewhere.