1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2026-01-04 09:33:30 +00:00

1. Updated so global events are unhooked when done

2. Updated so fake window is destroyed when done
This commit is contained in:
Bryan Roe
2019-10-30 14:40:25 -07:00
parent a0176c8f39
commit 6b8b25ebf9
2 changed files with 16 additions and 8 deletions

File diff suppressed because one or more lines are too long

View File

@@ -37,15 +37,16 @@ function WindowsMessagePump(options)
this._user32 = GM.CreateNativeProxy('User32.dll');
this._user32.mp = this;
this._user32.CreateMethod('GetMessageA');
this._user32.CreateMethod('CreateWindowExA');
this._user32.CreateMethod('TranslateMessage');
this._user32.CreateMethod('DispatchMessageA');
this._user32.CreateMethod('RegisterClassExA');
this._user32.CreateMethod('DefWindowProcA');
this._user32.CreateMethod('DestroyWindow');
this._user32.CreateMethod('DispatchMessageA');
this._user32.CreateMethod('GetMessageA');
this._user32.CreateMethod('PostMessageA');
this._user32.CreateMethod('ShowWindow');
this._user32.CreateMethod('RegisterClassExA');
this._user32.CreateMethod('SetWindowPos');
this._user32.CreateMethod('ShowWindow');
this._user32.CreateMethod('TranslateMessage');
this.wndclass = GM.CreateVariable(GM.PointerSize == 4 ? 48 : 80);
@@ -160,8 +161,15 @@ function WindowsMessagePump(options)
else
{
// We got a 'QUIT' message
delete this.nativeProxy.mp._hwnd;
this.nativeProxy.mp.emit('exit', 0);
this.nativeProxy.DestroyWindow.async(this.nativeProxy.RegisterClassExA.async, this.nativeProxy.mp._hwnd).then(function ()
{
this.nativeProxy.RegisterClassExA.async.abort();
delete this.nativeProxy.mp._hwnd;
this.nativeProxy.mp.emit('exit', 0);
this.nativeProxy.mp.wndclass.wndproc.removeAllListeners('GlobalCallback');
this.nativeProxy.mp.wndclass.wndproc = null;
});
}
}, function (err) { this.nativeProxy.mp.stop(); });
}