<table><tr><td style="">vkrause added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D25066">View Revision</a></tr></table><br /><div><div><blockquote style="border-left: 3px solid #8C98B8;
color: #6B748C;
font-style: italic;
margin: 4px 0 12px 0;
padding: 8px 12px;
background-color: #F8F9FC;">
<div style="font-style: normal;
padding-bottom: 4px;">In <a href="https://phabricator.kde.org/D25066#563978" style="background-color: #e7e7e7;
border-color: #e7e7e7;
border-radius: 3px;
padding: 0 4px;
font-weight: bold;
color: black;text-decoration: line-through;">D25066#563978</a>, <a href="https://phabricator.kde.org/p/dcaliste/" style="
border-color: #f1f7ff;
color: #19558d;
background-color: #f1f7ff;
border: 1px solid transparent;
border-radius: 3px;
font-weight: bold;
padding: 0 4px;">@dcaliste</a> wrote:</div>
<div style="margin: 0;
padding: 0;
border: 0;
color: rgb(107, 116, 140);"><p>Indeed, such snippet is segfaulting on the second toTimeZone() call:</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">QDateTime dt(QDate(2019, 11, 18), QTime(10, 0));
qDebug() << dt.toTimeZone(QTimeZone::systemTimeZone());
qDebug() << dt.toTimeZone(QTimeZone());</pre></div>
<p>This is happening on the test machine, because the systemTimeZone() is not defined and returning an invalid time zone, I guess. So the calendar in the test (created with such a call) does not have a valid timezone defined.</p></div>
</blockquote>
<p>The crashing code was using QTimeZone(), I added systemTimeZone() there to work around this issue. But yes, this confirms the problem I think.</p>
<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>Just like that, I would say it's a Qt bug, toTimeZone() should not segfault on an invalid time zone argument. Besides, for KCalendarCore, I'm wondering what it means to have a calendar without timezone defined. Does it make sense ? There is several possibilities to solve the issue:</p>
<ul class="remarkup-list">
<li class="remarkup-list-item">patch calendar constructor to fallback to UTC if the provided timezone on construction is invalid.</li>
<li class="remarkup-list-item">allow calendars to have invalid timezone and investigate everywhere if it's not creating issues. But the date accessor in memory calendar does not make sense without time zone defined for instance.
<br /><br />
It would prefer to go for the first solution, but I may be wrong, what do you think ?</li>
</ul></blockquote>
<p>I agree. I don't see what the semantics of an invalid timezone would be here, so just protecting against accidentally passing one in should be good enough.</p></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D25066">https://phabricator.kde.org/D25066</a></div></div><br /><div><strong>To: </strong>dcaliste, KDE PIM, winterz, vkrause, dvratil<br /><strong>Cc: </strong>KDE PIM, fbampaloukas, dcaliste, dvasin, rodsevich, winterz, vkrause, mlaurent, knauss, dvratil<br /></div>