Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Crash in takeChild() while deleting a QTreeWidgetItem

    General and Desktop
    5
    25
    12364
    Loading More Posts
    • 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.
    • T
      tobias.hunger last edited by

      Could you please use the code tags to format your code sections? It is hardly readable the way it is printed now!

      1 Reply Last reply Reply Quote 0
      • T
        thorbjorn last edited by

        This might have something to do with @modelTree->blockSignals(true);@, which I guess could cause the view not to be entirely aware of the child removals, but I'm not sure. In any case this forum is not the proper place to report bugs, you should use "http://bugreports.qt.nokia.com/":http://bugreports.qt.nokia.com/ for that.

        1 Reply Last reply Reply Quote 0
        • L
          LAXMIU last edited by

          .

          1 Reply Last reply Reply Quote 0
          • L
            LAXMIU last edited by

            Hi,
            I tried removing blockSignals from the deleteCurrent functionality , but it did not work out.

            Thanks, Laxmi

            1 Reply Last reply Reply Quote 0
            • L
              LAXMIU last edited by

              .

              1 Reply Last reply Reply Quote 0
              • L
                LAXMIU last edited by

                .

                1 Reply Last reply Reply Quote 0
                • D
                  DenisKormalev last edited by

                  LAXMIU, I've added highlighting to your code, please don't forget to use it by yourself in future :)

                  1 Reply Last reply Reply Quote 0
                  • A
                    alexander last edited by

                    why do you use takeChild()?
                    try only delete item

                    @void ModelForm::deleteCurrent() {
                    QList<QTreeWidgetItem *> itemList = modelTree->selectedItems();
                    for(int i= 0; i <itemList.size(); i++) {
                    if(itemList.at(i) != NULL && itemList.at(i)->parent() != NULL) {
                    QTreeWidgetItem *c=itemList.at(i);
                    QTreeWidgetItem p = c->parent();
                    delete c;
                    }
                    }
                    //now select the current item
                    QTreeWidgetItem
                    curItem = modelTree->currentItem();
                    if(curItem){
                    modelTree->setItemSelected(curItem, true);
                    }
                    }@

                    1 Reply Last reply Reply Quote 0
                    • L
                      LAXMIU last edited by

                      Hi Alexander,

                      I tried removing takeChild too, the crash now coming in the destructor of QTreeWidgetItem as follows:

                      #0 0x00270823 in QPersistentModelIndex::operator QModelIndex const& ()
                      from /net/ciclnx11d/export/home/laxmi/PERFORCE/DEL/lnx86/tools/Qt/32bit/lib/libQtCore.so.4
                      #1 0x0120539f in QAbstractItemView::updateEditorGeometries () from /net/ciclnx11d/export/home/laxmi/PERFORCE/DEL/lnx86/tools/Qt/32bit/lib/libQtGui.so.4
                      #2 0x011f6dd2 in QAbstractItemViewPrivate::_q_rowsRemoved () from /net/ciclnx11d/export/home/laxmi/PERFORCE/DEL/lnx86/tools/Qt/32bit/lib/libQtGui.so.4
                      #3 0x0123deaa in QTreeViewPrivate::rowsRemoved () from /net/ciclnx11d/export/home/laxmi/PERFORCE/DEL/lnx86/tools/Qt/32bit/lib/libQtGui.so.4
                      #4 0x0123e4eb in QTreeView::rowsAboutToBeRemoved () from /net/ciclnx11d/export/home/laxmi/PERFORCE/DEL/lnx86/tools/Qt/32bit/lib/libQtGui.so.4
                      #5 0x01202865 in QAbstractItemView::qt_metacall () from /net/ciclnx11d/export/home/laxmi/PERFORCE/DEL/lnx86/tools/Qt/32bit/lib/libQtGui.so.4
                      #6 0x012492ba in QTreeView::qt_metacall () from /net/ciclnx11d/export/home/laxmi/PERFORCE/DEL/lnx86/tools/Qt/32bit/lib/libQtGui.so.4
                      #7 0x0128212a in QTreeWidget::qt_metacall () from /net/ciclnx11d/export/home/laxmi/PERFORCE/DEL/lnx86/tools/Qt/32bit/lib/libQtGui.so.4
                      #8 0x00291583 in QMetaObject::activate () from /net/ciclnx11d/export/home/laxmi/PERFORCE/DEL/lnx86/tools/Qt/32bit/lib/libQtCore.so.4
                      #9 0x002921e2 in QMetaObject::activate () from /net/ciclnx11d/export/home/laxmi/PERFORCE/DEL/lnx86/tools/Qt/32bit/lib/libQtCore.so.4
                      #10 0x002cb7ff in QAbstractItemModel::rowsAboutToBeRemoved () from /net/ciclnx11d/export/home/laxmi/PERFORCE/DEL/lnx86/tools/Qt/32bit/lib/libQtCore.so.4
                      #11 0x00272965 in QAbstractItemModel::beginRemoveRows () from /net/ciclnx11d/export/home/laxmi/PERFORCE/DEL/lnx86/tools/Qt/32bit/lib/libQtCore.so.4
                      #12 0x0127f4c6 in QTreeModel::beginRemoveItems () from /net/ciclnx11d/export/home/laxmi/PERFORCE/DEL/lnx86/tools/Qt/32bit/lib/libQtGui.so.4
                      #13 0x0127f6b0 in QTreeWidgetItem::~QTreeWidgetItem () from /net/ciclnx11d/export/home/laxmi/PERFORCE/DEL/lnx86/tools/Qt/32bit/lib/libQtGui.so.4
                      #14 0x0804c7da in ModelForm::deleteCurrent (this=0x857ff60) at ModelForm.cpp:179

                      1 Reply Last reply Reply Quote 0
                      • L
                        LAXMIU last edited by

                        [quote author="Denis Kormalev" date="1285753913"]LAXMIU, I've added highlighting to your code, please don't forget to use it by yourself in future :)[/quote]

                        Hi Denis,
                        Please let me know the procedure/steps of highlighting the code. I really don't know. I am new to this forum. I could not either find any icon above for doing so.

                        Thanks andregards,
                        Laxmi

                        1 Reply Last reply Reply Quote 0
                        • ?
                          Guest last edited by

                          just enclose only your code with the @ tag ... one before and one after your code :)

                          1 Reply Last reply Reply Quote 0
                          • T
                            tobias.hunger last edited by

                            LAXMIU: ... or just mark the code with your mouse and click on the second icon from the right (the one with the tooltip "Code").

                            1 Reply Last reply Reply Quote 0
                            • T
                              tobias.hunger last edited by

                              This thread kind of reminds me of computer magazines in the early 80ties...

                              1 Reply Last reply Reply Quote 0
                              • D
                                DenisKormalev last edited by

                                [quote author="Tobias Hunger" date="1286270859"]This thread kind of reminds me of computer magazines in the early 80ties...[/quote]

                                A lot of code and small amount of text?:)

                                1 Reply Last reply Reply Quote 0
                                • L
                                  LAXMIU last edited by

                                  I have removed unnecessary repetition of code from the thread.
                                  Hopefully its readable now.

                                  Thanks,
                                  Laxmi

                                  1 Reply Last reply Reply Quote 0
                                  • ?
                                    Guest last edited by

                                    ok laxmi, I copied all the code and tried on Qt 4.7, no crashes ... any specific reason you are still on Qt 4.5.x ?

                                    1 Reply Last reply Reply Quote 0
                                    • L
                                      LAXMIU last edited by

                                      Thanks a lot Chetan,

                                      We have migrated from 4.4.1 to 4.5.3 in one of our product releases. Hopefully, we will be getting the latest Qt version attached for our next product release.

                                      May I get any pointer that its actually a bug in Qt 4.5.3?
                                      Have you been able to reproduce the crash in Qt 4.5.3? (If thats available with you)

                                      Thanks,
                                      Laxmi

                                      1 Reply Last reply Reply Quote 0
                                      • L
                                        LAXMIU last edited by

                                        "Qt 4.5.3 bug filed for this issue":http://bugreports.qt.nokia.com/browse/QTBUG-14572

                                        1 Reply Last reply Reply Quote 0
                                        • ?
                                          Guest last edited by

                                          hi laxmi, can u convert it to a link

                                          1 Reply Last reply Reply Quote 0
                                          • L
                                            LAXMIU last edited by

                                            Hi Chetan, I did .

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post