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. Why we should use 'clean'

Why we should use 'clean'

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 5 Posters 1.4k Views 2 Watching
  • 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.
  • R_IrudezuR Offline
    R_IrudezuR Offline
    R_Irudezu
    wrote on last edited by R_Irudezu
    #1

    I know it's too late for me to ask but i am facing some problems now. I am using some threads in my test projects. When i terminate UI, i can't restart project until press the clean. Can someone explain clean's function? What it does, why and when we should use, or should we?

    0_1543287799845_Capture.PNG

    Keizoku wa chikaranari.

    JKSHJ 1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      Where is the clean ? Which class ? Also you should avoid terminate of thread.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • R_IrudezuR R_Irudezu

        I know it's too late for me to ask but i am facing some problems now. I am using some threads in my test projects. When i terminate UI, i can't restart project until press the clean. Can someone explain clean's function? What it does, why and when we should use, or should we?

        0_1543287799845_Capture.PNG

        JKSHJ Offline
        JKSHJ Offline
        JKSH
        Moderators
        wrote on last edited by
        #3

        @R_Irudezu said in Why we should use 'clean':

        When i terminate UI, i can't restart project until press the clean.

        How do you stop your threads when you close your UI?

        Can someone explain clean's function? What it does, why and when we should use, or should we?

        Do you mean Qt Creator's "Clean" function? It basically deletes the files produced by your compiler. It is normally used to delete stale files after you make big changes to your project.

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        1 Reply Last reply
        4
        • R_IrudezuR Offline
          R_IrudezuR Offline
          R_Irudezu
          wrote on last edited by R_Irudezu
          #4

          Mr. @dheerendra I uploaded a screenshot. Why i should avoid terminate the threads?

          @JKSH I am stopping thread that i created like that:

          MainWindow::~MainWindow()
          {
              delete ui;
              worker1->terminate(); //a thread that subclassed from QThread
          }
          

          Keizoku wa chikaranari.

          jsulmJ 1 Reply Last reply
          0
          • dheerendraD Offline
            dheerendraD Offline
            dheerendra
            Qt Champions 2022
            wrote on last edited by
            #5

            clean has no relation to terminate(). After terminate just wait for few seconds to ensure that thread is really gone. Look at the documentation on why should you avoid terminate(...)

            Dheerendra
            @Community Service
            Certified Qt Specialist
            http://www.pthinks.com

            1 Reply Last reply
            1
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi,

              To add to @dheerendra terminate is also a "last resort" option, it literally kills the thread. You should rather have a mechanism to stop it gracefully.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1
              • R_IrudezuR R_Irudezu

                Mr. @dheerendra I uploaded a screenshot. Why i should avoid terminate the threads?

                @JKSH I am stopping thread that i created like that:

                MainWindow::~MainWindow()
                {
                    delete ui;
                    worker1->terminate(); //a thread that subclassed from QThread
                }
                
                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @R_Irudezu said in Why we should use 'clean':

                Why i should avoid terminate the threads?

                You find the answer in the documentation: http://doc.qt.io/qt-5/qthread.html#terminate

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

                1 Reply Last reply
                0
                • R_IrudezuR Offline
                  R_IrudezuR Offline
                  R_Irudezu
                  wrote on last edited by
                  #8

                  Thank you all, i got my answers :)
                  @dheerendra
                  @JKSH
                  @SGaist
                  @jsulm

                  Keizoku wa chikaranari.

                  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