summaryrefslogtreecommitdiff
path: root/avmedia
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-05-15 12:50:40 +0200
committerZolnai Tamás <tamas.zolnai@collabora.com>2014-05-15 14:23:42 +0200
commita48251956973525f338d297b07aad100e346ee9d (patch)
tree959bf03457cf072d2aba7fc19208952ffdade68f /avmedia
parent21a2ce0d09a34ca63aebb3821ce120a8e00e0d68 (diff)
OGLWindow: remove event listeners also when window is disposed
To avoid segmentation fault. Plus some comments. Change-Id: I7368b34a29b595f52975f41836d4fe1f63e4e859
Diffstat (limited to 'avmedia')
-rw-r--r--avmedia/source/opengl/oglwindow.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/avmedia/source/opengl/oglwindow.cxx b/avmedia/source/opengl/oglwindow.cxx
index 7bef3b4a5ed9..8f9eefa4eaec 100644
--- a/avmedia/source/opengl/oglwindow.cxx
+++ b/avmedia/source/opengl/oglwindow.cxx
@@ -25,6 +25,7 @@ OGLWindow::OGLWindow( glTFHandle* pHandle, OpenGLContext* pContext, SystemChildW
OGLWindow::~OGLWindow()
{
+ dispose();
}
void SAL_CALL OGLWindow::update() throw (css::uno::RuntimeException, std::exception)
@@ -81,6 +82,8 @@ uno::Sequence< OUString > SAL_CALL OGLWindow::getSupportedServiceNames() throw (
void SAL_CALL OGLWindow::dispose() throw (uno::RuntimeException, std::exception)
{
+ m_pEventHandler->GetParent()->RemoveEventListener( LINK(this, OGLWindow, FocusGrabber));
+ m_pEventHandler->RemoveEventListener( LINK(this, OGLWindow, CameraHandler));
}
void SAL_CALL OGLWindow::addEventListener( const uno::Reference< lang::XEventListener >& )
@@ -216,6 +219,7 @@ IMPL_LINK(OGLWindow, FocusGrabber, VclWindowEvent*, pEvent)
{
const Point& rMousePos = pMouseEvt->GetPosPixel();
const Rectangle aWinRect(m_pEventHandler->GetPosPixel(),m_pEventHandler->GetSizePixel());
+ // Grab focus to the OpenGL window when mouse pointer is over it
if( aWinRect.IsInside(rMousePos) )
{
if ( !m_pEventHandler->HasFocus() )
@@ -223,6 +227,7 @@ IMPL_LINK(OGLWindow, FocusGrabber, VclWindowEvent*, pEvent)
m_pEventHandler->GrabFocus();
}
}
+ // Move focus to the document when mouse is not over the OpenGL window
else if ( m_pEventHandler->HasFocus() )
{
m_pEventHandler->GrabFocusToDocument();
@@ -240,7 +245,7 @@ IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent*, pEvent)
KeyEvent* pKeyEvt = (KeyEvent*)pEvent->GetData();
if(pKeyEvt)
{
- sal_uInt16 nCode = pKeyEvt->GetKeyCode().GetCode();
+ const sal_uInt16 nCode = pKeyEvt->GetKeyCode().GetCode();
m_pContext->makeCurrent();
// Calculate movement