protected override void OnClosing(CancelEventArgs e) { _renderRunning = false; task.Stop(true); _traking.Dispose(); _detection.Dispose(); _recognize.Dispose(); Marshal.FreeHGlobal(_pImage); base.OnClosing(e); }
protected override void OnClosing(CancelEventArgs e) { _isRunning = false; _run.Wait(); _traking.Dispose(); _detection.Dispose(); _recognize.Dispose(); if (_capture.IsOpened) { _capture.Stop(); } _capture.Dispose(); //这里执行不时出现异常,还未找到解决方案 _receivedImage.Dispose(); base.OnClosing(e); }