<html>
<head>
<base href="https://bugs.documentfoundation.org/">
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - Call to loadCalendarTZ crashes LibreOffice"
href="https://bugs.documentfoundation.org/show_bug.cgi?id=133898#c5">Comment # 5</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - Call to loadCalendarTZ crashes LibreOffice"
href="https://bugs.documentfoundation.org/show_bug.cgi?id=133898">bug 133898</a>
from <span class="vcard"><a class="email" href="mailto:serval2412@yahoo.fr" title="Julien Nabet <serval2412@yahoo.fr>"> <span class="fn">Julien Nabet</span></a>
</span></b>
<pre>(In reply to Mike Kaganski from <a href="show_bug.cgi?id=133898#c4">comment #4</a>)
<span class="quote">> (In reply to Julien Nabet from <a href="show_bug.cgi?id=133898#c2">comment #2</a>)
> > The pb here is we got no context.
>
> Try introducing a local variable for context, assign it to m_xContext if
> it's valid, or to comphelper::getProcessComponentContext() otherwise; and
> use this local variable in place of m_xContext there?</span >
What about using comphelper::getProcessComponentContext() in the ctr where
context isn't provided by arg?
Also for the second ctr, if context provided by arg is empty, I'd use
comphelper::getProcessComponentContext() too, what do you think?
if you don't want ctrs be modified, I could change this block:
70 if (i >= sal::static_int_cast<sal_Int32>(lookupTable.size())) {
71 Reference < XInterface > xI =
m_xContext->getServiceManager()->createInstanceWithContext(
72 "com.sun.star.i18n.Calendar_" + uniqueID,
m_xContext);
73
74 if ( ! xI.is() ) {
75 // check if the calendar is defined in localedata, load
gregorian calendar service.
76 const Sequence< Calendar2 > xC =
LocaleDataImpl::get()->getAllCalendars2(rLocale);
77 if (std::any_of(xC.begin(), xC.end(), [&uniqueID](const
Calendar2& rCal) { return uniqueID == rCal.Name; }))
78 xI =
m_xContext->getServiceManager()->createInstanceWithContext("com.sun.star.i18n.Calendar_gregorian",
m_xContext);
79 }
by:
70 if (i >= sal::static_int_cast<sal_Int32>(lookupTable.size())) {
++ if (!m_xContext.is())
++ m_xContext = comphelper::getProcessComponentContext();
71 Reference < XInterface > xI =
m_xContext->getServiceManager()->createInstanceWithContext(
72 "com.sun.star.i18n.Calendar_" + uniqueID,
m_xContext);
73
74 if ( ! xI.is() ) {
75 // check if the calendar is defined in localedata, load
gregorian calendar service.
76 const Sequence< Calendar2 > xC =
LocaleDataImpl::get()->getAllCalendars2(rLocale);
77 if (std::any_of(xC.begin(), xC.end(), [&uniqueID](const
Calendar2& rCal) { return uniqueID == rCal.Name; }))
78 xI =
m_xContext->getServiceManager()->createInstanceWithContext("com.sun.star.i18n.Calendar_gregorian",
m_xContext);
79 }</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>