Segmentation fault when Qt QApplication created with new
QApplication
has a special (and IMHO questionable) requirement for argc
and argv
. See the documentation:
Warning: The data referred to by argc and argv must stay valid for the entire lifetime of the QApplication object. In addition, argc must be greater than zero and argv must contain at least one valid character string.
If argc
and argv
get destroyed during runtime, undefined behavior occurs. It may work on some platforms and it will crash on others. Change your code accordingly and check if it fixes your problem.