Qt World Summit: Register Today!

QT App error after device sleep.

  • Hi,
    I develop qt desktop application on OS linux run on raspberry pi 3.
    My application connect finger scan by USB port. Concept use timer loop receive image data from finger scan.
    I got problem some time when raspberry pi sleep after wake up when i scan finger print then application terminate and auto
    close windows.
    I try to debug to log file follow this link [https://evileg.com/en/post/154/](link url) but not write when app error to file.

    Problem not every time . just some time after device sleep. I can not find this bug.
    Please help . How to debug while application error .

  • Lifetime Qt Champion

    Might be something with the usb driver.
    Do you have some other app or cmdline to to interface with scanner?
    I would make it sleep for some time and and test if its still happy.
    Else it could also be a bug in app code so when driver is not 100%
    ready something goes wrong.
    Did you add checks and use any return code scanner api can give ?
    So in case it does report error, you stop the flow of app ?

  • Hi mrjj,

       Thanks for reply. no other app or cmdline. I use sdk C++  for scanner.
       Before app close i can get image from scanner. How to see qt log error ?
       void FVerify::onTimer(){

    if(GetImageAndData(1,m_fpimage,m_fpdata)) {

        char datetime_buff[100];
        time_t now = time (0);
        strftime (datetime_buff, 100, "%Y%m%d%H%M%S", localtime (&now));
        QString img_name = datetime_buff + ip_address.replace(".","");
        QByteArray save_part = "/mnt/fpTemp/";
        QByteArray full_path =  save_part.append(img_name.toLatin1());
        const char * c_savepath;
        c_savepath = full_path.data();
        img_verify = img_name;
        FILE *fh;
        fh  = fopen(c_savepath, "wb" );
        QPixmap pm(c_savepath);
        QPixmap newPixmap = pm.scaled(QSize(350,350),Qt::KeepAspectRatio);
        ui->lb_msgScan->setText("Lift finger");


  • Lifetime Qt Champion

    So app does take image and then crash ?

    How to see qt log error ?

    Im not sure what log you think about ?
    Qt dont write a log as such.

  • Banned

    This post is deleted!

  • Hi mrjj,

         Some time after device sleep while capture image app catch got error.

    The inferior stopped because it received a signal from the operating system.
    Signal name :
    Signal meaning :
    Segmentation fault

         I think may be the problem with driver library  scanner.
         Can i skip this error and do program loop again ? with out app closing.
         Do not want app windows close. or you have solution for check this error ?

  • Lifetime Qt Champion


    if you have SIGSEGV, you app has crashed. no way to recover. you have to find the origin of the crash (be it the library or your app) and to fix it.

    can you start your app from a command line? then I'd start adding qDebugs to see the program flow and find where things go wrong. esp. check all pointers before using them!


  • Lifetime Qt Champion

    Or enable coredumps on your system and debug the generated coredump later on - google is your friend when you don't know how to enable coredumps :)

  • Re: QT App error after device sleep.


    Thanks for all reply. 
     I can not check origin the crash because of library from finger print vendor was complied.
     can't edit or see source code in file. But i solving problem by use shell script loop check when QT process closed then re open 
    program again.

Log in to reply