Hello everyone,

I'm using the QScxmlStateMachine and wanted to use the QScxmlCppDataModel.
I copied the "mediaplayer-qml-cppdatamodel" example and executed it without any problem.

Since I'm not using QML, i replaced the main function with the following:

Qt Code:
  1. int main(int argc, char *argv[])
  2. {
  3. QCoreApplication a(argc, argv);
  4. QScxmlStateMachine* machine = new MediaPlayerStateMachine() ;
  5.  
  6. machine->start();
  7.  
  8. return a.exec();
  9. }
To copy to clipboard, switch view to plain text mode 

Unfortunately, I get a segmentation fault that I remove when I comment the line (in my .scxml) datamodel="cplusplus:TheDataModel:thedatamodel.h".

I also tried to simply add the QScxmlStateMachine instantiation and starting inside the original main function but it still fails.

Qt Code:
  1. int main(int argc, char *argv[])
  2. {
  3. QGuiApplication app(argc, argv);
  4.  
  5. qmlRegisterType<TheDataModel>("MediaPlayerDataModel", 1, 0, "MediaPlayerDataModel");
  6. qmlRegisterType<MediaPlayerStateMachine>("MediaPlayerStateMachine", 1, 0, "MediaPlayerStateMachine");
  7.  
  8. QQmlApplicationEngine engine;
  9. engine.load(QUrl(QStringLiteral("qrc:///mediaplayer-qml-cppdatamodel.qml")));
  10.  
  11. QScxmlStateMachine* machine = new MediaPlayerStateMachine() ;
  12. machine->start();
  13.  
  14. return app.exec();
  15. }
To copy to clipboard, switch view to plain text mode 


Launching in debug gives only the line where the error occurs which is return app.exec();

Does it ring a bell to anyone?


Thanks.

Qt5.7.1 on linux 64