Fix build: move CrashReporter code to vcl/source/window/builder.cxx

This problem appeared after commit 1a1bf2b78d
(tdf#130857 VclBuilder: Extract helper to start parsing UI file, 2024-09-26):

[LNK] Library/libvclplug_qt5lo.so
/home/mk/core/include/vcl/widgetbuilder.hxx:55: error: undefined reference to 'CrashReporter::addKeyValue(rtl::OUString const&, rtl::OUString const&, CrashReporter::tAddKeyHandling)'
collect2: error: ld returned 1 exit status
make[1]: *** [/home/mk/core/vcl/Library_vclplug_qt5.mk:20: /home/mk/build/instdir/program/libvclplug_qt5lo.so] Error 1

Change-Id: I212aa3cbc381770de8fec07ea6454ab209edefc6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173977
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
Mike Kaganski
2024-09-26 13:40:54 +05:00
parent e4ab68142c
commit 70a183875a
3 changed files with 13 additions and 4 deletions

View File

@@ -14,6 +14,8 @@
#include <vcl/dllapi.h> #include <vcl/dllapi.h>
#include <vcl/EnumContext.hxx> #include <vcl/EnumContext.hxx>
#include <com/sun/star/uno/Exception.hpp>
#include <map> #include <map>
#include <vector> #include <vector>
@@ -105,6 +107,8 @@ protected:
virtual void resetParserState(); virtual void resetParserState();
static void reportException(const css::uno::Exception& rExcept);
private: private:
struct ParserState struct ParserState
{ {

View File

@@ -11,7 +11,6 @@
#include <com/sun/star/uno/Exception.hpp> #include <com/sun/star/uno/Exception.hpp>
#include <comphelper/diagnose_ex.hxx> #include <comphelper/diagnose_ex.hxx>
#include <desktop/crashreport.hxx>
#include <sal/log.hxx> #include <sal/log.hxx>
#include <vcl/builderbase.hxx> #include <vcl/builderbase.hxx>
#include <xmlreader/span.hxx> #include <xmlreader/span.hxx>
@@ -52,9 +51,7 @@ protected:
catch (const css::uno::Exception& rExcept) catch (const css::uno::Exception& rExcept)
{ {
TOOLS_WARN_EXCEPTION("vcl.builder", "Unable to read .ui file " << getUIFileUrl()); TOOLS_WARN_EXCEPTION("vcl.builder", "Unable to read .ui file " << getUIFileUrl());
CrashReporter::addKeyValue(u"VclBuilderException"_ustr, reportException(rExcept);
"Unable to read .ui file: " + rExcept.Message,
CrashReporter::Write);
assert(false && "missing ui file or missing gb_CppunitTest_use_uiconfigs dependency"); assert(false && "missing ui file or missing gb_CppunitTest_use_uiconfigs dependency");
throw; throw;
} }

View File

@@ -72,6 +72,7 @@
#include <PriorityHBox.hxx> #include <PriorityHBox.hxx>
#include <window.h> #include <window.h>
#include <xmlreader/xmlreader.hxx> #include <xmlreader/xmlreader.hxx>
#include <desktop/crashreport.hxx>
#include <calendar.hxx> #include <calendar.hxx>
#include <menutogglebutton.hxx> #include <menutogglebutton.hxx>
#include <salinst.hxx> #include <salinst.hxx>
@@ -442,6 +443,13 @@ namespace weld
} }
} }
// static
void BuilderBase::reportException(const css::uno::Exception& rExcept)
{
CrashReporter::addKeyValue(u"VclBuilderException"_ustr,
"Unable to read .ui file: " + rExcept.Message, CrashReporter::Write);
}
BuilderBase::BuilderBase(std::u16string_view sUIDir, const OUString& rUIFile, bool bLegacy) BuilderBase::BuilderBase(std::u16string_view sUIDir, const OUString& rUIFile, bool bLegacy)
: m_pParserState(new ParserState) : m_pParserState(new ParserState)
, m_sUIFileUrl(sUIDir + rUIFile) , m_sUIFileUrl(sUIDir + rUIFile)