summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-03-01 12:27:39 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-03-01 12:56:03 +0000
commit3dcde4bb979b0f7685c1ab0029aa7274cd92c904 (patch)
tree9822024ae80731f2c05cf5c129620a2ca0aba9e1 /vcl
parent62e5c2422cfd0e4c7f3ae3a84e9a8462db4a19dc (diff)
return null DefaultWindow if it cannot be created
Change-Id: Id0ec9c123ca151db793380ffd7b719dbb239efa9
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/app/svdata.cxx24
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx5
2 files changed, 19 insertions, 10 deletions
diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx
index 6df85097d4cc..b27abd9aa41f 100644
--- a/vcl/source/app/svdata.cxx
+++ b/vcl/source/app/svdata.cxx
@@ -141,18 +141,26 @@ vcl::Window *ImplGetDefaultContextWindow()
{
SolarMutexGuard aGuard;
- if ( !pSVData->mpDefaultWin && !pSVData->mbDeInit )
+ if (!pSVData->mpDefaultWin && !pSVData->mbDeInit)
{
- SAL_INFO( "vcl", "ImplGetDefaultWindow(): No AppWindow" );
- pSVData->mpDefaultWin = VclPtr<WorkWindow>::Create( nullptr, WB_DEFAULTWIN );
- pSVData->mpDefaultWin->SetText( "VCL ImplGetDefaultWindow" );
+ try
+ {
+ SAL_INFO( "vcl", "ImplGetDefaultWindow(): No AppWindow" );
+
+ pSVData->mpDefaultWin = VclPtr<WorkWindow>::Create( nullptr, WB_DEFAULTWIN );
+ pSVData->mpDefaultWin->SetText( "VCL ImplGetDefaultWindow" );
#if HAVE_FEATURE_OPENGL
- // Add a reference to the default context so it never gets deleted
- rtl::Reference<OpenGLContext> pContext = pSVData->mpDefaultWin->GetGraphics()->GetOpenGLContext();
- if( pContext.is() )
- pContext->acquire();
+ // Add a reference to the default context so it never gets deleted
+ rtl::Reference<OpenGLContext> pContext = pSVData->mpDefaultWin->GetGraphics()->GetOpenGLContext();
+ if( pContext.is() )
+ pContext->acquire();
#endif
+ }
+ catch (const css::uno::Exception& e)
+ {
+ SAL_WARN("vcl", "unable to create Default Window: " << e.Message);
+ }
}
}
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 743107bcf684..d031f9c01848 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -506,10 +506,11 @@ rtl::Reference<OpenGLContext> OpenGLContext::getVCLContext(bool bMakeIfNecessary
pContext = pContext->mpPrevContext;
}
rtl::Reference<OpenGLContext> xContext;
- if( !pContext && bMakeIfNecessary )
+ vcl::Window* pDefWindow = !pContext && bMakeIfNecessary ? ImplGetDefaultWindow() : nullptr;
+ if (pDefWindow)
{
// create our magic fallback window context.
- xContext = ImplGetDefaultContextWindow()->GetGraphics()->GetOpenGLContext();
+ xContext = pDefWindow->GetGraphics()->GetOpenGLContext();
assert(xContext.is());
}
else