Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Difference in behaviour between addImportPath and qmlRegisterType



  • Hello all,

    Thanks for taking the time. My question is: does importPath differ in the way it loads libraries, compared to qmlRegisterType?

    I have this peculiar segfault which occurs when I import a qml plugin:

    engine.addImportPath("../../../imports"); // contains PocketsphinxDecoderPlugin dir
    

    However, it does not occur when I load the same shared library (minus the qmldir file) via c++:

    #include <pocketsphinxdecoder.h>
    // and in main
    qmlRegisterType<PocketsphinxDecoder>("PocketsphinxDecoderPlugin", 1,0, "PocketsphinxDecoder");
    

    For good measure I tried importPlugin, which didn't work either. Note that the segfault occurs well within the program, between when a function is called and the debugger can step into it. AFAICT, the arguments' contents aren't corrupted. I can provide additional information, but it's rather complicated (the fault occurs in another library). I'm mostly trying to see if this looks familiar to someone before I try and work around it.

    Thank you for your time,
    Sean