Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Crash in debug but not in release
Forum Updated to NodeBB v4.3 + New Features

Crash in debug but not in release

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 853 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • FranckynosF Offline
    FranckynosF Offline
    Franckynos
    wrote on last edited by
    #1

    I have made some function in my code like this method:

     MyMessageBox m(this);
        m.setText(tr("Chargement des goupilles..."));
        QPixmap p(":/icones/wait");
        p=p.scaled(150,150);
        QMovie *mov = new QMovie(":/gif/wait");
        m.setStartMovie(mov);
        m.showButtons(false,false);
        m.setObjectName("Mon message d'attente");
    
        //BUG: PROBLEME ICI plantage en mode debug
        QtConcurrent::run(this, SelectGoupRef::runFindPins, &m);
        m.exec();
    
        this->accept();
    

    The current class is QDialog(this)
    I create a messageBox to show a waiting state for the user, the runFindPins is the process and when the computation is done, is say "accept" to MyMessageBox (m.accept();).

    In Release mode all work fine but in Debug my app crash ???

    1 Reply Last reply
    0
    • jsulmJ Online
      jsulmJ Online
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      You should NEVER manipulate UI from a different thread!
      This is not supported. Instead you should emit a signal from the thread which is connected to a slot in main thread which closes the message box (use Qt::QueuedConnection in connect(...)).

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • FranckynosF Offline
        FranckynosF Offline
        Franckynos
        wrote on last edited by
        #3

        You have right I change with:=>

        QFutureWatcher<void> watcher;
            connect(&watcher, SIGNAL(finished()), &m, SLOT(accept()));
            watcher.setFuture(QtConcurrent::run(this, &SelectGoupRef::runFindPins, &watcher));
        

        And no problem in debug.

        Thx

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved