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. QPushButton set checked causes program to crash
Qt 6.11 is out! See what's new in the release blog

QPushButton set checked causes program to crash

Scheduled Pinned Locked Moved Unsolved General and Desktop
19 Posts 2 Posters 4.0k Views 1 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.
  • mrjjM Offline
    mrjjM Offline
    mrjj
    Lifetime Qt Champion
    wrote on last edited by
    #10

    hi
    do
    SetWidgetProperty
    called setChecked ?
    if that triggers clicked(bool) u get infinite calls.

    Q 1 Reply Last reply
    0
    • mrjjM mrjj

      hi
      do
      SetWidgetProperty
      called setChecked ?
      if that triggers clicked(bool) u get infinite calls.

      Q Offline
      Q Offline
      Qtstarter121
      wrote on last edited by
      #11

      @mrjj The thing is, If I do this:

       cButton->setChecked(true);
      //on_button1_clicked(true); 
      

      I still get the same crash. Which tells me on_button1_clicked(bool) is irrelevant. Right?

      mrjjM 1 Reply Last reply
      0
      • Q Qtstarter121

        @mrjj The thing is, If I do this:

         cButton->setChecked(true);
        //on_button1_clicked(true); 
        

        I still get the same crash. Which tells me on_button1_clicked(bool) is irrelevant. Right?

        mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #12

        @Qtstarter121
        yeah, seems so.
        so it seems to crash on ?
        cButton->setChecked(true);
        since you dont have debugger
        use qDebug

        qDebug() << "before";
        cButton->setChecked(true);
        qDebug() << "after";

        to fidn WHAT makes it crash

        1 Reply Last reply
        0
        • Q Offline
          Q Offline
          Qtstarter121
          wrote on last edited by
          #13

          Hold on I might be wrong about that. Let me try something and get back to you.

          mrjjM 1 Reply Last reply
          0
          • Q Qtstarter121

            Hold on I might be wrong about that. Let me try something and get back to you.

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #14

            @Qtstarter121
            You really should install debugger. :)
            Its ment to find stuff like this :)

            Q 1 Reply Last reply
            1
            • Q Offline
              Q Offline
              Qtstarter121
              wrote on last edited by
              #15

              Okay so it looks like i am having an off-day because I just found out the source of my problem.
              Turns out the issue was with code in the slot ( not Qt stuff but c++ using a proprietary framework) I neglected to post which was using an uninitialized variable. facepalm

              I neglected to include it because I wrongly assumed the code wasn't relevant.

              Sorry for wasting your time and thanks for the help.

              1 Reply Last reply
              0
              • mrjjM mrjj

                @Qtstarter121
                You really should install debugger. :)
                Its ment to find stuff like this :)

                Q Offline
                Q Offline
                Qtstarter121
                wrote on last edited by
                #16

                @mrjj I actually do have a debugger available and installed. The problem is that the way my program is launched, i'm not sure how I can run it with gdb. if I attempt a command such as " gdb < my usual program launch command>
                I get an error like this: not in executable format: File format not recognized

                However I can attach a debugger once my process is running via gdb attach < pid > but in this case the issue was in my constructor so that would run immediately and no time to attach the debugger to catch the crash issue so print statements are my only option.

                mrjjM 1 Reply Last reply
                0
                • Q Qtstarter121

                  @mrjj I actually do have a debugger available and installed. The problem is that the way my program is launched, i'm not sure how I can run it with gdb. if I attempt a command such as " gdb < my usual program launch command>
                  I get an error like this: not in executable format: File format not recognized

                  However I can attach a debugger once my process is running via gdb attach < pid > but in this case the issue was in my constructor so that would run immediately and no time to attach the debugger to catch the crash issue so print statements are my only option.

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #17

                  @Qtstarter121
                  You are not using Creator?

                  Q 1 Reply Last reply
                  0
                  • mrjjM mrjj

                    @Qtstarter121
                    You are not using Creator?

                    Q Offline
                    Q Offline
                    Qtstarter121
                    wrote on last edited by
                    #18

                    @mrjj nope, gdb.

                    mrjjM 1 Reply Last reply
                    0
                    • Q Qtstarter121

                      @mrjj nope, gdb.

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #19

                      @Qtstarter121
                      Ok so you compile outside of Creator and not using the dgb integration ?

                      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