private static void ShutDown_Callback(IntPtr intPtr, int arg) { ShutdownHandle shutdownHandle = GetObjectFromHandel <ShutdownHandle>(intPtr); if (shutdownHandle == null || shutdownHandle._callBack == null) { return; } try { shutdownHandle._callBack(arg, shutdownHandle._state); } catch { //ignore } shutdownHandle.DoDispose(); shutdownHandle.Dispose(); shutdownHandle._callBack = null; shutdownHandle._state = null; }