Skip to content

Don't attempt to sync colors when application is shutting down

Joshua Goins requested to merge work/redstrate/fix-destructor-crash into master

I hit an interesting bug when Tokodon is closing, when running on qqc2-desktop-style (note that qqc2-breeze-style does not exhibit the same behavior, despite having a similar logic for syncing colors...)

The crash happens here in KConfigWidgets:

static KSharedConfigPtr defaultConfig()
{
    ...
    const auto colorSchemePath = qApp->property("KDE_COLOR_SCHEME_PATH").toString();
    ...
}

It attempts to access qApp and Tokodon goes out with a bang - not good. Now we check if the application is closing down, and early exit from syncing colors. We should add checks in KConfigWidgets too, but we can at least early exit here to prevent the crash entirely, and also probably save effort syncing colors when it's not even needed or visible.

Merge request reports