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. App crash on emitting signal
Qt 6.11 is out! See what's new in the release blog

App crash on emitting signal

Scheduled Pinned Locked Moved Solved General and Desktop
17 Posts 8 Posters 7.9k 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.
  • jsulmJ jsulm

    @TagLog said in App crash on emitting signal:

    on_taskChanged

    What does on_taskChange do? Did you try to use debugger to go step by step through it to see where exactly it crashes and why?

    T Offline
    T Offline
    TagLog
    wrote on last edited by
    #7

    @jsulm It call another function called updateWindow(), but that function is also called by other buttons and stuff, so the problem is in the connection/signal/slot

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

      Hi,

      Please post the stack trace of your crash, that should help pinpoint the problem.

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

      T 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        Please post the stack trace of your crash, that should help pinpoint the problem.

        T Offline
        T Offline
        TagLog
        wrote on last edited by TagLog
        #9

        @SGaist

        This is the stack trace (as a newbie, I think the problem could be in thread 1, the last one in the stack trace), in a breakpoint the debugger says this message: Disassembler failed: Cannot access memory at address 0x6a85097c, the function is unknown (??)

        jsulmJ 1 Reply Last reply
        0
        • T TagLog

          @SGaist

          This is the stack trace (as a newbie, I think the problem could be in thread 1, the last one in the stack trace), in a breakpoint the debugger says this message: Disassembler failed: Cannot access memory at address 0x6a85097c, the function is unknown (??)

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #10

          @TagLog
          Can you show the content of following methods:

          • MainWindow::updateTree
          • MainWindow::updateWindow
          • MainWindow::on_taskChanged
            ?

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

          T 1 Reply Last reply
          0
          • jsulmJ jsulm

            @TagLog
            Can you show the content of following methods:

            • MainWindow::updateTree
            • MainWindow::updateWindow
            • MainWindow::on_taskChanged
              ?
            T Offline
            T Offline
            TagLog
            wrote on last edited by
            #11

            @jsulm
            Here you go:

            void MainWindow::on_taskChanged(){
              updateWindow();
            }
            
            void MainWindow::updateWindow()
            {
            
              currentScene->clear();
            
              for (unsigned i = 0; i < 12; i ++){
                  childrenScenes[i]->clear();
              }
            
              ui->btnModify->setEnabled(true);
              ui->btnComplete->setEnabled(true);
              ui->btnAddChild->setEnabled(true);
            
              ui->lblProjectTitle->setText(currentProj.getTitle());
              ui->lblCurrentTitle->setText(currentTask->getTitle());
              ui->tedCurrentText->setText(currentTask->getText());
            
              currentTask->drawAsCurrent(currentScene);
            
              for(unsigned i = 0; i < 12 && i < currentTask->getChildren().size(); i++){
                  childrenScenes[i]->setTaskShown(currentTask->getChildren()[i] );
                  childrenScenes[i]->drawTaskShown();
              }
              updateTree();
            }
            
            void MainWindow::updateTree(){
            
              QString TaskTree;
              Task* masterPointer = currentTask;
            
              while(masterPointer != Q_NULLPTR){
                  TaskTree = "/" + masterPointer->getTitle() + TaskTree;
                  masterPointer = currentTask->getMaster();
              }
            
              ui->lblDepTree->setText(TaskTree);
            }
            

            I'm willing for any explanation if you need

            1 Reply Last reply
            0
            • BjornWB Offline
              BjornWB Offline
              BjornW
              wrote on last edited by BjornW
              #12

              First suspects are the following:

               for (unsigned i = 0; i < 12; i ++){
                    childrenScenes[i]->clear();
                }
              

              and

                for(unsigned i = 0; i < 12 && i < currentTask->getChildren().size(); i++){
                    childrenScenes[i]->setTaskShown(currentTask->getChildren()[i] );
                    childrenScenes[i]->drawTaskShown();
                }
              

              Are you confident thay you remain in bounds here? for both containers (currentTask->getChildren() and childrenScenes)?

              EDIT: also, what is

              currentTask
              

              ? Is it set properly?

              T 1 Reply Last reply
              2
              • VRoninV Offline
                VRoninV Offline
                VRonin
                wrote on last edited by
                #13

                If you make assumptions in your code, assert them (even static assert them if you can)

                • is currentTask null?
                • is currentScene null?
                • is childrenScenes of size >=12
                • is any childrenScenes[i] null

                The easiest way to debug this is put a breakpoint at the first line of on_taskChanged and step into/over every line untill you find exactly where it explodes and fix whatever is wrong there

                "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                ~Napoleon Bonaparte

                On a crusade to banish setIndexWidget() from the holy land of Qt

                VRoninV 1 Reply Last reply
                2
                • BjornWB BjornW

                  First suspects are the following:

                   for (unsigned i = 0; i < 12; i ++){
                        childrenScenes[i]->clear();
                    }
                  

                  and

                    for(unsigned i = 0; i < 12 && i < currentTask->getChildren().size(); i++){
                        childrenScenes[i]->setTaskShown(currentTask->getChildren()[i] );
                        childrenScenes[i]->drawTaskShown();
                    }
                  

                  Are you confident thay you remain in bounds here? for both containers (currentTask->getChildren() and childrenScenes)?

                  EDIT: also, what is

                  currentTask
                  

                  ? Is it set properly?

                  T Offline
                  T Offline
                  TagLog
                  wrote on last edited by TagLog
                  #14

                  @BjornW In this test case I remain in bounds in those lines of code.

                  currentTask is a pointer to a custom class object which is initialized at the beginnning of the test.

                  1 Reply Last reply
                  0
                  • VRoninV VRonin

                    If you make assumptions in your code, assert them (even static assert them if you can)

                    • is currentTask null?
                    • is currentScene null?
                    • is childrenScenes of size >=12
                    • is any childrenScenes[i] null

                    The easiest way to debug this is put a breakpoint at the first line of on_taskChanged and step into/over every line untill you find exactly where it explodes and fix whatever is wrong there

                    VRoninV Offline
                    VRoninV Offline
                    VRonin
                    wrote on last edited by
                    #15

                    @VRonin said in App crash on emitting signal:

                    The easiest way to debug this is put a breakpoint at the first line of on_taskChanged and step into/over every line untill you find exactly where it explodes and fix whatever is wrong there

                    "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                    ~Napoleon Bonaparte

                    On a crusade to banish setIndexWidget() from the holy land of Qt

                    T 2 Replies Last reply
                    1
                    • VRoninV VRonin

                      @VRonin said in App crash on emitting signal:

                      The easiest way to debug this is put a breakpoint at the first line of on_taskChanged and step into/over every line untill you find exactly where it explodes and fix whatever is wrong there

                      T Offline
                      T Offline
                      TagLog
                      wrote on last edited by TagLog
                      #16

                      @VRonin I'm doing this right now, as soon as I finish I'll tell you what I found

                      Edit: I can't find anything now, but for few days I can't look at the code, I'll continue to look ASAP

                      1 Reply Last reply
                      0
                      • VRoninV VRonin

                        @VRonin said in App crash on emitting signal:

                        The easiest way to debug this is put a breakpoint at the first line of on_taskChanged and step into/over every line untill you find exactly where it explodes and fix whatever is wrong there

                        T Offline
                        T Offline
                        TagLog
                        wrote on last edited by
                        #17

                        @VRonin

                        I finally found what caused crashes: it was the UpdateTree function. I wrote a wrong line which caused an infinite loop. I'm feeling both stupid and happy :) / :(

                        1 Reply Last reply
                        2

                        • Login

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