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. Crash inserting QTreeWidgetItem into a QTreeWidget
Forum Updated to NodeBB v4.3 + New Features

Crash inserting QTreeWidgetItem into a QTreeWidget

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.2k 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.
  • C Offline
    C Offline
    ceadious
    wrote on last edited by
    #1

    Hello,

    I don't know if anybody can verify and duplicate the problem I'm having. Here's the details :

    I rebuild Qt 4.8.2 in 64 Bits using MSVC2010 under Windows 7 Pro 64 Bits. I'm creating a simple GUI Application using QtCreator, adding a QTreeWidget in the main window, and then adding a QTreeWidgetItem from within the constructor.

    Here's the constructor code :

    @
    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);

    ui->treeWidget->addTopLevelItem( new QTreeWidgetItem() );
    

    }
    @

    Only added the addTopLevelItem line.

    If I run the application in debug, everything is fine. But when I try to run it in Release, it crash at startup.

    Anybody else having that ?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      marsupial
      wrote on last edited by
      #2

      How does it crash, does it show an error message?
      Maybe some dependencies (DLLs) are missing in release folder?

      1 Reply Last reply
      0
      • C Offline
        C Offline
        ceadious
        wrote on last edited by
        #3

        It shows an error dialog from Windows asking to look for solution, close or debug the application. I'm pretty sure it's not a dependency, if I comment out the line where I add the widget it starts fine. Plus only dependencies it has are Qt4Core and Qt4Gui dlls, which are present.

        To put in context, I have a bigger program that crashes in release 64 bits only. It works well in debug 32 and 64 bits, as well as release 32 bits. I was able to narrow down the problem to the addTopLevelItem line. The test application containing the line shown in previous post was made to confirm the quickest way to get the problem.

        I forgot to add the fact I recompiled Qt libs with wchar_t enabled.

        1 Reply Last reply
        0
        • C Offline
          C Offline
          ceadious
          wrote on last edited by
          #4

          Just as a follow-up for those interested, I spent some time debugging QtGui4.dll and found the problem.

          The crash happends in QAbstractItemView.cpp in function :

          @
          QStyleOptionViewItem QAbstractItemView::viewOptions() const
          @

          at line 3576

          @
          option.rect = QRect();
          @

          I looked in QRect class and found no assignment operator. So I implemented one to check and everything worked fine after. It's a very simple fix.

          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