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 <hossein@libreoffice.org>
This commit is contained in:
Chris Sherlock
2022-01-21 12:43:30 +01:00
committed by Hossein
parent a9bb94e28a
commit fced837029
8 changed files with 42 additions and 8 deletions
+1
View File
@@ -28,6 +28,7 @@ $(eval $(call gb_Executable_use_libraries,minvcl,\
cppuhelper \
comphelper \
i18nlangtag \
fwk \
))
$(eval $(call gb_Executable_add_exception_objects,minvcl,\
+5 -1
View File
@@ -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))
+2
View File
@@ -27,6 +27,8 @@ $(eval $(call gb_Executable_use_libraries,svdemo,\
cppu \
cppuhelper \
comphelper \
i18nlangtag \
fwk \
))
$(eval $(call gb_Executable_add_exception_objects,svdemo,\
+4 -2
View File
@@ -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))
+2 -1
View File
@@ -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;
+11 -3
View File
@@ -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);
}
+8 -1
View File
@@ -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&)
+9
View File
@@ -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();