vcl/Executable_minvcl.mk | 1 + vcl/Executable_mtfdemo.mk | 6 +++++- vcl/Executable_svdemo.mk | 2 ++ vcl/Executable_vcldemo.mk | 6 ++++-- vcl/workben/minvcl.cxx | 3 ++- vcl/workben/mtfdemo.cxx | 14 +++++++++++--- vcl/workben/svdem.cxx | 9 ++++++++- vcl/workben/vcldemo.cxx | 9 +++++++++ 8 files changed, 42 insertions(+), 8 deletions(-)
New commits: commit fced837029123f34a125f5a794e5681ed297fc2a Author: Chris Sherlock <[email protected]> AuthorDate: Thu Jan 20 22:57:45 2022 +0100 Commit: Hossein <[email protected]> CommitDate: Fri Jan 21 12:43:30 2022 +0100 tdf#146478 vcl: vcldemo and other vcl examples segfault on close We need to call on framework's shutdown to cleanup after ourselves properly. This has only become apparent after commit 6e35794ca where we assert if we try to dispose to process's component context before we shutdown the app properly. During this we also noticed that we got a warning: warn:i18nlangtag:1855739:1855739:i18nlangtag/source/isolang/mslangid.cxx:105: MsLangId::getConfiguredSystemLanguage() - not configured yet So I have fixed this by configuring the system language at init. Change-Id: I3cb73b1dad84f1097696c15e5c845d97fa58befa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127796 Tested-by: Jenkins Reviewed-by: Hossein <[email protected]> diff --git a/vcl/Executable_minvcl.mk b/vcl/Executable_minvcl.mk index 8de973dcd1f4..f3b603e8c61b 100644 --- a/vcl/Executable_minvcl.mk +++ b/vcl/Executable_minvcl.mk @@ -28,6 +28,7 @@ $(eval $(call gb_Executable_use_libraries,minvcl,\ cppuhelper \ comphelper \ i18nlangtag \ + fwk \ )) $(eval $(call gb_Executable_add_exception_objects,minvcl,\ diff --git a/vcl/Executable_mtfdemo.mk b/vcl/Executable_mtfdemo.mk index 92a37af1858f..4b192c14533a 100644 --- a/vcl/Executable_mtfdemo.mk +++ b/vcl/Executable_mtfdemo.mk @@ -21,12 +21,16 @@ $(eval $(call gb_Executable_set_include,mtfdemo,\ )) $(eval $(call gb_Executable_use_libraries,mtfdemo,\ - basegfx \ + basegfx \ tl \ sal \ cppu \ cppuhelper \ comphelper \ + fwk \ + drawinglayer \ + emfio \ + i18nlangtag \ )) $(eval $(call gb_Executable_use_vclmain,mtfdemo)) diff --git a/vcl/Executable_svdemo.mk b/vcl/Executable_svdemo.mk index 00083247b934..f6d8b9df3afb 100644 --- a/vcl/Executable_svdemo.mk +++ b/vcl/Executable_svdemo.mk @@ -27,6 +27,8 @@ $(eval $(call gb_Executable_use_libraries,svdemo,\ cppu \ cppuhelper \ comphelper \ + i18nlangtag \ + fwk \ )) $(eval $(call gb_Executable_add_exception_objects,svdemo,\ diff --git a/vcl/Executable_vcldemo.mk b/vcl/Executable_vcldemo.mk index 19b7ee655af9..e4076ac08231 100644 --- a/vcl/Executable_vcldemo.mk +++ b/vcl/Executable_vcldemo.mk @@ -31,13 +31,15 @@ $(eval $(call gb_Executable_set_include,vcldemo,\ )) $(eval $(call gb_Executable_use_libraries,vcldemo,\ - basegfx \ + basegfx \ comphelper \ cppu \ cppuhelper \ tl \ sal \ - salhelper \ + salhelper \ + fwk \ + i18nlangtag \ )) $(eval $(call gb_Executable_use_vclmain,vcldemo)) diff --git a/vcl/workben/minvcl.cxx b/vcl/workben/minvcl.cxx index 9592769879fa..e6beb2f95b4a 100644 --- a/vcl/workben/minvcl.cxx +++ b/vcl/workben/minvcl.cxx @@ -7,6 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include <framework/desktop.hxx> #include <cppuhelper/bootstrap.hxx> #include <comphelper/processfactory.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -67,9 +68,9 @@ static int main_impl() TheApplication aApp; InitVCL(); int ret = aApp.Main(); + framework::getDesktop(::comphelper::getProcessComponentContext())->terminate(); DeInitVCL(); - css::uno::Reference<css::lang::XComponent>(xContext, css::uno::UNO_QUERY_THROW)->dispose(); comphelper::setProcessServiceFactory(nullptr); return ret; diff --git a/vcl/workben/mtfdemo.cxx b/vcl/workben/mtfdemo.cxx index aae7c092a163..9ed8a2404a5b 100644 --- a/vcl/workben/mtfdemo.cxx +++ b/vcl/workben/mtfdemo.cxx @@ -30,6 +30,9 @@ #include <sal/log.hxx> #include <osl/file.hxx> #include <osl/process.h> +#include <framework/desktop.hxx> +#include <i18nlangtag/languagetag.hxx> +#include <i18nlangtag/mslangid.hxx> #include <iostream> @@ -106,6 +109,7 @@ public: mpWin->Show(); Application::Execute(); + mpWin.disposeAndClear(); } catch (const css::uno::Exception&) { @@ -124,6 +128,8 @@ private: uno::Reference<lang::XMultiServiceFactory> xMSF; void Init() override { + LanguageTag::setConfiguredSystemLanguage(MsLangId::getSystemLanguage()); + try { const sal_uInt16 nCmdParams = GetCommandLineParamCount(); @@ -208,6 +214,8 @@ private: aMtf.dumpAsXml(rtl::OUStringToOString(sAbsoluteDumpUrl, RTL_TEXTENCODING_UTF8).getStr()); std::cout << "Dumped metaactions as metadump.xml" << std::endl; + framework::getDesktop(::comphelper::getProcessComponentContext())->terminate(); + framework::getDesktop(::comphelper::getProcessComponentContext())->disposing(); std::exit(0); } @@ -220,9 +228,9 @@ private: void DeInit() override { - uno::Reference< lang::XComponent >( - comphelper::getProcessComponentContext(), - uno::UNO_QUERY_THROW)-> dispose(); + framework::getDesktop(::comphelper::getProcessComponentContext())->terminate(); + framework::getDesktop(::comphelper::getProcessComponentContext())->disposing(); + ::comphelper::setProcessServiceFactory(nullptr); } diff --git a/vcl/workben/svdem.cxx b/vcl/workben/svdem.cxx index 399a3683f853..27245ac84388 100644 --- a/vcl/workben/svdem.cxx +++ b/vcl/workben/svdem.cxx @@ -21,9 +21,11 @@ #include <sal/log.hxx> #include <tools/diagnose_ex.h> #include <tools/extendapplicationenvironment.hxx> - #include <cppuhelper/bootstrap.hxx> #include <comphelper/processfactory.hxx> +#include <i18nlangtag/languagetag.hxx> +#include <i18nlangtag/mslangid.hxx> +#include <framework/desktop.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/uno/XComponentContext.hpp> @@ -53,8 +55,13 @@ SAL_IMPLEMENT_MAIN() comphelper::setProcessServiceFactory( xServiceManager ); + LanguageTag::setConfiguredSystemLanguage(MsLangId::getSystemLanguage()); + InitVCL(); ::Main(); + + framework::getDesktop(::comphelper::getProcessComponentContext())->terminate(); + DeInitVCL(); } catch (const Exception&) diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index a89857c099a7..68abc47f7cb7 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -57,6 +57,10 @@ #include <basegfx/numeric/ftools.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <framework/desktop.hxx> +#include <i18nlangtag/languagetag.hxx> +#include <i18nlangtag/mslangid.hxx> + #define FIXME_SELF_INTERSECTING_WORKING 0 #define FIXME_BOUNCE_BUTTON 0 #define THUMB_REPEAT_FACTOR 10 @@ -2222,6 +2226,8 @@ public: protected: void Init() override { + LanguageTag::setConfiguredSystemLanguage(MsLangId::getSystemLanguage()); + try { uno::Reference<uno::XComponentContext> xComponentContext @@ -2240,6 +2246,9 @@ protected: } void DeInit() override { + framework::getDesktop(::comphelper::getProcessComponentContext())->terminate(); + framework::getDesktop(::comphelper::getProcessComponentContext())->disposing(); + uno::Reference< lang::XComponent >( comphelper::getProcessComponentContext(), uno::UNO_QUERY_THROW)-> dispose();
