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

Quazip JlCompress::extractDir error



  • Hi all,
    I must decompress a zip archive.
    I'm trying to use Quazip.
    To include the library, I've added these lines inside .pro file

    ###################### QUAZIP ######################
    INCLUDEPATH += $$PWD/libs/quazip-0.7.3/quazip
    INCLUDEPATH += $$PWD/libs/zlib-1.2.8
    win32 {
        LIBS += "$$PWD/libs/zlib-1.2.8/bin/win_x64/zlib.lib"
        LIBS += "$$PWD/libs/quazip-0.7.3/quazip/bin/win_x64/quazip.lib"
    }
    
    linux:!android {
        LIBS += -L$$PWD/libs/zlib-1.2.8/bin/linux_x64/ -lzlib
        LIBS += -L$$PWD/libs/quazip-0.7.3/quazip/bin/linux_x64/ -lquazip
    }
    

    I got an error when I call

    JlCompress::extractDir(zipSourceFile, output_path);
    

    The problem seems the deallocation of the returned QStringList.
    This is the error received...

    7b6cfbc7-a6e0-41be-acd1-ff6e93f92241-immagine.png

    If I press the "ignore" button I got this error.

    b50b1a94-2720-44b1-b717-383919f55492-immagine.png

    If I press the "ignore" button I got this error.

    45db3b92-e2a0-4970-9e83-970596676fb8-immagine.png
    ....and this is the code:

    void WindowRestart::unzipSourceFile(const QString &zipSourceFile)
    {
        qDebug() << "zipSourceFile:" << zipSourceFile;
        if (QFile::exists(zipSourceFile))
        {
            QFileInfo fileinfo(m_processFullPath);
            QString output_path = fileinfo.absolutePath() + "/../";
            qDebug() << "output_path" << output_path;
            if (!QFileInfo::exists(output_path))
            {
                QDir dir;
                dir.mkpath(output_path);
            }
    
            JlCompress::extractDir(zipSourceFile, output_path);  // <--- ERROR WHEN I EXECUTE THIS LINE
    
            //        QStringList zip_files = JlCompress::extractDir(zipSourceFile, output_path);
            //        if (zip_files.isEmpty())
            //        {
            //            QMessageBox::critical(this, "Error extracting the project",
            //                                  QString("Impossible to open the the file\n\nProbably you are attemping to extract a corrupted zip file"),
            //                                  QMessageBox::Close);
            //        }
        }
    }
    

    The files are correctly extracted.
    I'm using QT 5.14.2 under Windows 10.

    Thank you for every suggestions.


Log in to reply