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. Application is crashing on A20-olimexXino-Micro board with debian jessy linux on it with Qt5.6
Qt 6.11 is out! See what's new in the release blog

Application is crashing on A20-olimexXino-Micro board with debian jessy linux on it with Qt5.6

Scheduled Pinned Locked Moved Solved General and Desktop
12 Posts 3 Posters 4.6k 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.
  • S Sagar Ojha

    Application is crashing on A20-olimexXino-Micro board with debian jessy linux on it with Qt5.6 and backtracing giving the output:

    Error: signal 11:
    Critical: [bt]: ( 1 ) /lib/arm-linux-gnueabihf/libc.so.6 : + 0x24fd0 [0xb5ea2fd0] (main.cpp:134, void handler(int))
    Critical: [bt]: ( 2 ) /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5 : _ZNK11QObjectData17dynamicMetaObjectEv + 0x7 [0xb6335004] (main.cpp:134, void handler(int))
    stack trace:
    Segmentation faul

    _ZNK11QObjectData17dynamicMetaObjectEv:- QObjectData::dynamicMetaObject() Const

    meanwhile, running the same project on ubuntu 14.04 with qt5.5.1 on it, not giving any problem.

    void mqttClient::onTblClientClicked(const QModelIndex &index)
    {
    devStr = ui->tblClient->model()->data(ui->tblClient->model()->index(ui->tblClient->currentRow(),ui->tblClient->currentColumn())).toString();
    strDelDevInfo = devStr;
    qDebug() << devStr;

    if(listClientsItems.at(index.row())->objWidget == NULL)
    {
        MsgBox.setText("Reload Application");
        MsgBox.exec();
       qDebug() << "Reload Application";
        return;
    }
    
    foreach(dev_clientsData* data, listClientsItems)
    {
        qDebug() << "foreach start";
        if(devStr.compare(data->Name, Qt::CaseSensitive) == 0)
        {
            qDebug() << "if objwidget is null";
            if(data->objWidget != NULL)
            {
                qDebug() << "if devstr name compaired";
                ui->frame->layout()->removeWidget(formWidget);
                formWidget->setVisible(false);
                layout->addWidget(data->objWidget);
                data->objWidget->setVisible(true);
                formWidget = data->objWidget;
                break;
                qDebug() << "EO name compaired";
            }
        }
    }
    
    qDebug() << "End TblClient Clicked";
    

    }

    above function is slot for QTableWidget cell click event.

    when i comment
    ui->frame->layout()->removeWidget(formWidget);
    formWidget->setVisible(false);
    layout->addWidget(data->objWidget);
    data->objWidget->setVisible(true);
    formWidget = data->objWidget;

    this part of the code, application works filne, but I have to load widget on table cell click event as it is our requirment.

    Thanks in advance for any help :)

    S Offline
    S Offline
    Sagar Ojha
    wrote on last edited by
    #2

    @Sagar-Ojha Do I need to provide some more section of code to understand the problem???

    1 Reply Last reply
    1
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #3

      You are just doing something unbelievably intricate for an operation that would be trivial with a QStyledItemDelegate. Did you consider using it instead?

      "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

      1 Reply Last reply
      1
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by mrjj
        #4

        Hi
        Its good description but nothing really spring to eye.
        Only note is removeWidget will take out the widget from layout
        but ownership remains the same.
        So if the original parent is deleted, it will delete it also.
        But you seem to override it anyway with
        formWidget = data->objWidget;

        Also, this
        devStr = ui->tblClient->model()->data(ui->tblClient->model()->index(ui->tblClient->currentRow(),ui->tblClient->currentColumn())).toString();

        Makes me nervous as one NULL and its a crash :)

        S 1 Reply Last reply
        1
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #5

          Other possible sources of problems:

          • MsgBox on the stack if you supply a parent in the constructor
          • what is layout?

          "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

          1 Reply Last reply
          2
          • mrjjM mrjj

            Hi
            Its good description but nothing really spring to eye.
            Only note is removeWidget will take out the widget from layout
            but ownership remains the same.
            So if the original parent is deleted, it will delete it also.
            But you seem to override it anyway with
            formWidget = data->objWidget;

            Also, this
            devStr = ui->tblClient->model()->data(ui->tblClient->model()->index(ui->tblClient->currentRow(),ui->tblClient->currentColumn())).toString();

            Makes me nervous as one NULL and its a crash :)

            S Offline
            S Offline
            Sagar Ojha
            wrote on last edited by
            #6

            @mrjj is it possible
            ui->tblClient->model()->data(ui->tblClient->model()->index(ui->tblClient->currentRow(),ui->tblClient->currentColumn())).toString();

            this will return NULL, I mean, if there is a cell present on tablewidget, only then I am able to clicke on it, and in this condition is it possible??

            mrjjM 1 Reply Last reply
            0
            • S Sagar Ojha

              @mrjj is it possible
              ui->tblClient->model()->data(ui->tblClient->model()->index(ui->tblClient->currentRow(),ui->tblClient->currentColumn())).toString();

              this will return NULL, I mean, if there is a cell present on tablewidget, only then I am able to clicke on it, and in this condition is it possible??

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

              @Sagar-Ojha
              Hi
              Yes if only used when clicking it might be safe.
              But its also a bit hard to read compared to something like

              auto model = ui->tblClient->model();
              auto client = ui->tblClient;
              int row = client -> currentRow();
              int row = client -> currentColumn();
              devStr = model->data(  model->index ( row, col ) ).toString();
              
              S 1 Reply Last reply
              1
              • mrjjM mrjj

                @Sagar-Ojha
                Hi
                Yes if only used when clicking it might be safe.
                But its also a bit hard to read compared to something like

                auto model = ui->tblClient->model();
                auto client = ui->tblClient;
                int row = client -> currentRow();
                int row = client -> currentColumn();
                devStr = model->data(  model->index ( row, col ) ).toString();
                
                S Offline
                S Offline
                Sagar Ojha
                wrote on last edited by
                #8

                @mrjj This code is working fine,
                What would be the correct way to remove privious widget and add another widget to a frame, am i missing something to do the same??

                mrjjM 1 Reply Last reply
                0
                • S Sagar Ojha

                  @mrjj This code is working fine,
                  What would be the correct way to remove privious widget and add another widget to a frame, am i missing something to do the same??

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

                  @Sagar-Ojha said in Application is crashing on A20-olimexXino-Micro board with debian jessy linux on it with Qt5.6:

                  What would be the correct way to remove privious widget and add another widget to a frame, am i missing something to do the same??

                  You mean a QFrame with a layout ?

                  Or do you mean how to have widgets in cells of a View class ?

                  If its anything to do with Table/tree views then as @VRonin suggest the right way is via
                  QStyledItemDelegate

                  So its depends :)

                  S 1 Reply Last reply
                  0
                  • mrjjM mrjj

                    @Sagar-Ojha said in Application is crashing on A20-olimexXino-Micro board with debian jessy linux on it with Qt5.6:

                    What would be the correct way to remove privious widget and add another widget to a frame, am i missing something to do the same??

                    You mean a QFrame with a layout ?

                    Or do you mean how to have widgets in cells of a View class ?

                    If its anything to do with Table/tree views then as @VRonin suggest the right way is via
                    QStyledItemDelegate

                    So its depends :)

                    S Offline
                    S Offline
                    Sagar Ojha
                    wrote on last edited by
                    #10

                    @mrjj Yes, I ment QFrame with a layout.

                    mrjjM 1 Reply Last reply
                    0
                    • S Sagar Ojha

                      @mrjj Yes, I ment QFrame with a layout.

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

                      @Sagar-Ojha
                      Then there is nothing wrong with removeWidget as such. :)

                      For QTableWidget stuff, delegates are "better".

                      1 Reply Last reply
                      2
                      • S Offline
                        S Offline
                        Sagar Ojha
                        wrote on last edited by
                        #12

                        Problem related to this topic is solved. There are other problems with this project I am dealing now, thanks @mrjj and @VRonin your suggestion were helpfull regarding to this problem :)

                        1 Reply Last reply
                        1

                        • Login

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