QXmlQuery::evaluateTo problem



  • Hi,

    I encounter a very strange issue with the evaluateTo method of QXmlQuery.

    My code parse an xml file (XPath format).
    On Linux, it works very well, on debug and release mode.
    On Mac and Windows, it works well on debug mode, but when i compile on release mode, the application crashes.
    The file I parse is approximately 1Mb size.

    If i reduce the file size by removing some nodes, it works well on release mode (Mac, Win)

    Here is the code.

    @
    void MyClass::getXpath(QString str, QString queryXpath, QString defaultNamespace)
    {
    QBuffer device;
    QStringList outArrayList;
    QXmlQuery query;

    device.setData(str.toUtf8());
    device.open(QIODevice::ReadOnly);
    query.bindVariable("stackfile", &device);
    query.setQuery(defaultNamespace+"declare variable $stackfile external;doc($stackfile)"+queryXpath);
    if(query.isValid() != true)
        qDebug() << "XPATH query is invalid !";
    

    // On windows and Mac, it crashes here on release mode with big filesize
    if(!query.evaluateTo(&outArrayList))
    qDebug() << "Cannot evaluate XPATH query !";

    device.close();
    ....
    
    return;
    

    }
    @

    Thanks for your help.



  • Hi,

    I just experienced the same behavior.
    Have you found any solution ?



  • I also got the same error. Tracing the problem down, I can see the q.evaluateTo() function which crashes because of too many recursive calls.

    As we can see in this entry from gdb, it was called 74788 times before crashing. Quite a bit!

    #74788 0x00007ffff64510c9 in QPatternist::ItemMappingIterator<QPatternist::Item, QPatternist::Item, QExplicitlySharedDataPointer<QPatternist::GenericPredicate const>, QExplicitlySharedDataPointerQPatternist::DynamicContext >::next (this=0x73983c0) at iterators/qitemmappingiterator_p.h:120

    The XSLT works perfectly with smaller XML data. When it crashes, my file is a little over 2Mb, with an 8Gb computer, you'd think that it would not crash, although if more stack "than necessary" is used, it is not surprising...


  • Lifetime Qt Champion

    Hi,

    Maybe worth to take a look at the bug report system to see if it's something known


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.