Ok, so, what I’m doing is I have an object QmlGui that has a member QQuickView view, here’s the constructor of QmlGui:
QmlGui::QmlGui() {
view.setSource(QUrl::fromLocalFile(bin_dir + "/qml/main.qml")); // Set QML source
view.setResizeMode(QQuickView::SizeRootObjectToView);
view.show();
}
At another point I have:
QmlGui *qmlGui = new QmlGui();
Then later, after entering the main Qt loop, there is a call to a function containing the following:
printf("TEST A\n");
QObject *view_obj = qmlGui->view.rootObject();
printf("TEST B\n");
QObject *firstRunDialog = view_obj->findChild<QObject*>("firstRunDialog");
printf("TEST C\n");
bool result = QMetaObject::invokeMethod(firstRunDialog, "firstRun", Qt::DirectConnection);
printf("%d\n", result);
if(result) return 0;
And it segfaults on the line “QObject *view_obj = qmlGui->view.rootObject();”, I don’t understand why it’s segfaulting here, it really shouldn’t be, qmlGui is in scope, so it’s not like this function doesn’t know about it, qmlGui->view has been fully created/initialized, I have used gdb and it only shows me the line where it segfaults.
Any help is appreciated, thanks
↧