Marc Mutz 01ced9d45a syncqt.cpp: don't init static variables with non-static data
Static variables are only initialized once, when control passes over
their definition for the first time¹. If they are initialized with
non-static data, like the contents of a non-static data member, or the
address of one, then all following uses of the object will continue to
use the first control pass' data, even if the data members were from
an object that has since been deleted.

This whole construct appears to have worked merely because these
functions are only executed once, or at least not on different
objects. But better remove the dangerous construct while it hasn't
broken something, yet, and before we e.g. make syncqt a library² or
add a mode that makes it scan multiple modules at once.

Requires to capture more variables in the parseArgument() lambda; more
than fits into an explicit capture list, so use a [&] catch-all
instead.

As a drive-by, use CTAD to not have to mention the number of elements
in a std::array, but have the compiler deduce them, and add const,
where it's missing.

Amends b89d63515bb352cecfd87e709320a2db5b6a1906 (and maybe a few
in-between, we'll see when cherry-picking).

¹ Except corner-case like when initialization fails by throwing an
  exception.
² see similar ideas for moc, e.g.: QTBUG-132820

Pick-to: 6.9 6.8 6.5
Change-Id: I65a73059151e3d39341939f613080e6d833a4c30
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-04-10 18:46:01 +02:00
2025-03-24 19:01:57 +02:00
2024-11-05 14:36:16 +01:00
2025-04-03 21:39:13 +00:00
2024-11-05 14:36:16 +01:00
2024-12-13 14:54:23 +00:00
2025-03-24 23:19:04 +01:00
2025-04-09 13:49:11 +02:00
2024-06-25 11:44:00 +02:00
Description
Qt Base (Core, Gui, Widgets, Network, ...)
822 MiB
Languages
C++ 84.3%
HTML 4.9%
C 3.9%
CMake 3.6%
Objective-C++ 2%
Other 0.8%