summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2020-07-25 18:55:18 +0300
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2020-08-05 23:26:12 +0200
commit21184becd97392e142f61225cc7d45daa6cbe97b (patch)
treeb71c8ff21bd3760cc4374c0bbd78e7fc87fd6aec
parenttdf#134250 sw_redlinehide: fix copy non-empty node before non-textnode (diff)
downloadcore-21184becd97392e142f61225cc7d45daa6cbe97b.tar.gz
core-21184becd97392e142f61225cc7d45daa6cbe97b.zip
tdf#130559: don't fail creation of preview when BackingComp can't add...
an event listener. This crashes when loading a document with print preview set as active view. Regression after commit 128ecffe53394c1f045521c2efb42ea03a319f4b. Change-Id: I5dc421f7c08dd70d51772fac5432f33cd9a1491a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99442 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> (cherry picked from commit e3b695f6a1525ac6b32abd27a6368a7e8b7d09fa) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99740 Reviewed-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit a9457b3c18f6030b19d8cb1aada3709649a05460) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99747 Reviewed-by: Michael Stahl <michael.stahl@cib.de> (cherry picked from commit 810b9dabc0b91629b0aadadb999b396a7879b385) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99923 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r--sc/source/ui/view/prevwsh.cxx19
1 files changed, 15 insertions, 4 deletions
diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx
index fe3688abdd43..54187748819f 100644
--- a/sc/source/ui/view/prevwsh.cxx
+++ b/sc/source/ui/view/prevwsh.cxx
@@ -153,10 +153,21 @@ ScPreviewShell::ScPreviewShell( SfxViewFrame* pViewFrame,
{
Construct( &pViewFrame->GetWindow() );
- SfxShell::SetContextBroadcasterEnabled(true);
- SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context::Printpreview));
- SfxShell::BroadcastContextForActivation(true);
-
+ try
+ {
+ SfxShell::SetContextBroadcasterEnabled(true);
+ SfxShell::SetContextName(
+ vcl::EnumContext::GetContextName(vcl::EnumContext::Context::Printpreview));
+ SfxShell::BroadcastContextForActivation(true);
+ }
+ catch (const css::uno::RuntimeException& e)
+ {
+ // tdf#130559: allow BackingComp to fail adding listener when opening document
+ css::uno::Reference<css::lang::XServiceInfo> xServiceInfo(e.Context, css::uno::UNO_QUERY);
+ if (!xServiceInfo || !xServiceInfo->supportsService("com.sun.star.frame.StartModule"))
+ throw;
+ SAL_WARN("sc.ui", "Opening file from StartModule straight into print preview");
+ }
auto& pNotebookBar = pViewFrame->GetWindow().GetSystemWindow()->GetNotebookBar();
if (pNotebookBar)