/// <summary> /// Deinitialize. Release the vertex buffer and the render target resources /// This function should be called at last when playing has been stopped /// </summary> public void Deinit() { GUIWindowManager.Receivers -= new SendMessageHandler(this.OnMessage); GUILayerManager.UnRegisterLayer(this); if (_renderTarget != null) { //VMR9 changes the directx 9 render target. Thats why we set it back to what it was if (!_renderTarget.Disposed) { GUIGraphicsContext.DX9Device.SetRenderTarget(0, _renderTarget); } _renderTarget.SafeDispose(); _renderTarget = null; } for (int i = 0; i < _vertexBuffers.Length; i++) { if (_vertexBuffers[i] != null) { _vertexBuffers[i].SafeDispose(); _vertexBuffers[i] = null; } } if (_blackImage != null) { _blackImage.SafeDispose(); _blackImage = null; } grabber.Clean(); SubtitleRenderer.GetInstance().Clear(); }