mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 09:33:25 -08:00
[Tests] Keep the icon render test QApplication alive until exit
Creating it as a function-local static tears it down before Qt's library statics at exit, and libQt6Network then runs QObject destructors against freed memory — a SEGV the sanitizer leg reports after the tests have already passed. Leak the application instead, the usual pattern for a test binary.
This commit is contained in:
parent
fa5133071d
commit
ba05e2d094
1 changed files with 4 additions and 1 deletions
|
|
@ -28,7 +28,10 @@ void ensureGuiApplication()
|
||||||
static int argc = 1;
|
static int argc = 1;
|
||||||
static char name[] = "theme_icon_test";
|
static char name[] = "theme_icon_test";
|
||||||
static char *argv[] = {name, nullptr};
|
static char *argv[] = {name, nullptr};
|
||||||
static QApplication app(argc, argv);
|
// Leaked on purpose: a function-local static QApplication is destroyed before Qt's
|
||||||
|
// own library statics at exit, and the network module's destructors then run
|
||||||
|
// against a torn-down QObject layer (SEGV under AddressSanitizer).
|
||||||
|
static QApplication *app = new QApplication(argc, argv);
|
||||||
Q_UNUSED(app);
|
Q_UNUSED(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue