Why my program pauses at"int 3"again and again?



  • When i run my program on debug mode and copy a folder it will pause on this
    0_1542611011383_591b6197-f040-4223-b575-de4afeed43f8-image.png
    0_1542611097998_966f2ddf-6e53-4fa1-b70d-303bb4812594-image.png
    if i click to go on it will pause here again and again

    If not debug mode it will crash
    0_1542611187282_976c8f49-a50c-4748-81fd-8d04d65e6d8e-image.png


  • Moderators

    @mais
    QT version? compiler? platform?

    What folder are you traversing with your qmlfolderlistmodel? I don't see why QDirIterator should call a method from QtWebEngine...



  • @raven-worx said in Why my program pauses at"int 3"again and again?:

    platform

    qt5.10.1 msvc14.0 windows
    i havn't used FolderListModel,my qml call the c++ method to copy folder,when it run the "qfile::copy()"it will pause at int 3

    and if i run it on release mode everything is ok



  • @mais said in Why my program pauses at"int 3"again and again?:

    and if i run it on release mode everything is ok

    That is contradictory to your opening post

    If not debug mode it will crash

    did you change something?
    Can you share the ode of the function that was last called?



  • @J.Hilk not change anything
    debug build&run it will crash
    debug build&debug run it will int3
    release build ok
    sorry i havn't expressed clearly

    code here

    bool ESFileUtil::copyDirectory(const QString &fromDir, const QString &toDir, bool coverFileIfExist) {
        QDir sourceDir(fromDir);
        QDir targetDir(toDir);
        if(!targetDir.exists()){
            if(!targetDir.mkdir(targetDir.absolutePath()))
                return false;
        }
    
        QFileInfoList fileInfoList = sourceDir.entryInfoList();
        foreach(QFileInfo fileInfo, fileInfoList){
            if(fileInfo.fileName() == "." || fileInfo.fileName() == "..")
                continue;
    
            if(fileInfo.isDir()) {
                if(!ESFileUtil::copyDirectory(fileInfo.filePath(),
                    targetDir.filePath(fileInfo.fileName()),
                    coverFileIfExist))
                    return false;
            } else {
                if (coverFileIfExist && targetDir.exists(fileInfo.fileName())) {
                    targetDir.remove(fileInfo.fileName());
                }
                if (!QFile::copy(fileInfo.filePath(), targetDir.filePath(fileInfo.fileName()))) {//crash here
                        return false;
                }
            }
        }
        return true;
    }
    


  • @mais
    Code in itself looks vaguely OK. But what is ESFileUtil::copyDirectory() as opposed to the FileUtil::copyDirectory() you show?

    Your backtrace shows it's dying in a QtWebEngine call, that's what I'd be looking at. Like @raven-worx said, why is that involved??


  • Moderators

    @mais
    to me it looks looks like you are mixing up Qt binaries.
    Can you verify if all Qt libs which are loaded are correct?
    This can be done in QtCreator's Debug pane. There is a Modules view (which is by default hidden. To show Window -> Views -> Modules)


  • Qt Champions 2017

    That interrupt is ordinarily reserved for debuggers to trap breakpoints. But it's not clear, so let me reiterate:

    1. What has WebEngine have to do with the code?
    2. What is ESFileUtil and where does it come from?
    3. The code you provided does not correspond the stack trace, can you explain?


  • @kshegunov
    1.webengine do nothing with this code,i use webengine to show a url in the other module.the program really run this

    if (!QFile::copy(fileInfo.filePath(), targetDir.filePath(fileInfo.fileName()))) {//crash here
                        return false;
                }
    

    and show the stack trace int the picture

    WebEngineView{
            webChannel: webc
            id: webEngineView
            anchors.fill: parent;
            url:esLoginBridgeModel.i_nowUrl;
            onLoadingChanged:{
                if (loadRequest.status === WebEngineLoadRequest.LoadSucceededStatus ||
                        loadRequest.status === WebEngineLoadRequest.LoadFailedStatus){
                        if ( rectPreview.visible )
                        {
                            delay(200, function(){
                                    previewGif.playing = false;
                                    rectPreview.visible = false;
                                  } )
                        }
                }
            }
        }
    

    they don't call each other
    2.ESFileUtil is the func self name .i deleted es



  • Hi, just guessing but maybe you need to call WebEngineView::grantFeaturePermission to get a security clearance for copying local files inside the web view.
    You could also try creating a modal dialog box outside of the webview and do the qFile::copy() in that dialog box.


  • Qt Champions 2017

    @kshegunov said in Why my program pauses at"int 3"again and again?:

    The code you provided does not correspond the stack trace, can you explain? [Sic]


Log in to reply
 

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