My problem is supposedly very similar to QWebPage segmentation fault but none of the suggested solutions there help me.
I'm trying to run a unit test for a module of our console application that should render a web page to a PDF. As far as I understand the chapter Using QWebPage in a Widget-less Environment this is what QWebPage
is meant to be there for.
But still, the unit test segfaults inside the constructor of QWebPage
.
class ReportingTest : public QObject
{
Q_OBJECT
public:
ReportingTest();
private Q_SLOTS:
void initTestCase();
void reportsCanBeGenerated();
void cleanupTestCase();
private:
QWebPage webPage;
};
Guessing from the call stack I would say, that it still tries to create widgets although it shouldn't:
0 WebKit::initializeWebKitWidgets()
1 ??
2 QWebPage::QWebPage(QObject*)
3 ReportingTest::ReportingTest
4 main
I cannot use the other accepted answer and switch from QCoreApplication
to QApplication
as it is mandatory to run as a UI-less daemon.
The second question does not have an effect either, creating the object on the heap or on the stack produces the same error with the same call stack.