summaryrefslogtreecommitdiffstats
path: root/src/corelib/time/qcalendar.h
diff options
context:
space:
mode:
authorIevgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>2021-07-22 17:44:36 +0200
committerIevgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>2021-08-06 19:46:18 +0200
commit84a93d94ac8dfa3c962c0dda0ab19bbd80ac50ed (patch)
tree5497ebcbaca746d2ff76e9d0b609c807efbc38d0 /src/corelib/time/qcalendar.h
parentd0ae1ef33a6eed02acde7304298794f4f0119e16 (diff)
QCalendar: Delete registered calendar backends on program exit
Add code to check if the calendar registry is destroyed to all QCalendar methods that dereference QCalendarBackend pointer. Pick-to: 6.2 Change-Id: I9b562355e2e0579396b52968f6065c6927cc9ca8 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/corelib/time/qcalendar.h')
-rw-r--r--src/corelib/time/qcalendar.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/corelib/time/qcalendar.h b/src/corelib/time/qcalendar.h
index aedbae94fb..3238fff7d8 100644
--- a/src/corelib/time/qcalendar.h
+++ b/src/corelib/time/qcalendar.h
@@ -153,7 +153,7 @@ public:
explicit QCalendar(SystemId id);
// QCalendar is a trivially copyable value type.
- bool isValid() const { return d != nullptr; }
+ bool isValid() const { return d_ptr != nullptr; }
// Date queries:
int daysInMonth(int month, int year = Unspecified) const;
@@ -201,7 +201,10 @@ public:
static QStringList availableCalendars();
private:
// Always supplied by QCalendarBackend and expected to be a singleton
- const QCalendarBackend *d;
+ // Note that the calendar registry destroys all backends when it is itself
+ // destroyed. The code should check if the registry is destroyed before
+ // dereferencing this pointer.
+ const QCalendarBackend *d_ptr;
};
QT_END_NAMESPACE