D25066: Handle incidences in different time zones in MemoryCalendar.

Volker Krause noreply at phabricator.kde.org
Mon Nov 18 09:55:23 GMT 2019


vkrause added a comment.


  In D25066#563978 <https://phabricator.kde.org/D25066#563978>, @dcaliste wrote:
  
  > Indeed, such snippet is segfaulting on the second toTimeZone() call:
  >
  >   QDateTime dt(QDate(2019, 11, 18), QTime(10, 0));
  >   qDebug() << dt.toTimeZone(QTimeZone::systemTimeZone());
  >   qDebug() << dt.toTimeZone(QTimeZone());
  >   
  >
  > 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.
  
  
  The crashing code was using QTimeZone(), I added systemTimeZone() there to work around this issue. But yes, this confirms the problem I think.
  
  > 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:
  > 
  > - patch calendar constructor to fallback to UTC if the provided timezone on construction is invalid.
  > - 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.
  > 
  >   It would prefer to go for the first solution, but I may be wrong, what do you think ?
  
  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.

REVISION DETAIL
  https://phabricator.kde.org/D25066

To: dcaliste, #kde_pim, winterz, vkrause, dvratil
Cc: #kde_pim, fbampaloukas, dcaliste, dvasin, rodsevich, winterz, vkrause, mlaurent, knauss, dvratil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20191118/5019f7ea/attachment-0001.html>


More information about the kde-pim mailing list