avoid accesing QCoreApplication in static constant before an instance was created

Review Request #128711 - Created Aug. 18, 2016 and submitted

Martin Koller

Without this patch starting ktp-contactlist prints 4 times
QCoreApplication::arguments: Please instantiate the QApplication object first
even before hitting a breakpoint in main.
The reason is the constant definition this patch fixes, since it uses IconSize() which internally uses KIconLoader which somehow accesses QCoreApplication::arguments
(don't have the full stack here right now).
The result is also that no icons are shown and when closing the window the program crashes.

The patch fixes this by not using a const variable which is initialized too early but just uses
a #define which produces the code which is only run when the class instances are created.

Now no messages are printed from Qt, icons are shown, and the program no longer crashes on exit.


David Edmundson
Alexandr Akulich
Alexandr Akulich
Martin Koller
Review request changed

Status: Closed (submitted)

Change Summary:

Submitted with commit ec09594081d1b6556f1ab2f82ff5ea17b4de442f by Martin Koller to branch Applications/16.08.