Important: Please read the Qt Code of Conduct -

Qt Error : Assert: “nativeExtra” in file kernel\qwidget_win.cpp line 1804

  • The above error is appearing when I close the application. When I comment following code error disappears, so source of error is in this code:

    this->tfwidget = new TFWidget();//twwidget inherits QWidget

        QHBoxLayout* lay = new QHBoxLayout();
        delete ui->TabVisualization->layout();//adding tab to the tabwidget
        delete this->tfwidget;//if user uncheck button remove widget from tab
        delete ui->TabVisualization->layout();

    If I keep only layout insertion and deletion there is no any error. it appears only when I initialze and add widget to the layout. I have no clue why it is happening and how to resolve. Please help.

    What I think the classes in TFWidget having some problem, I have tested widget without this way like removing layout and it is working fine. I don know what is the matter while including widget in this way.

  • Lifetime Qt Champion


    Since you are using a QTabWidget, why are you deleting it's layout ? It's not the proper way to use that widget.

  • I removed all the code of delete and all. But if I just add my widget to the tab it is causing error by this I got that that the my widget is having some issue, though the code of widget i tested without definition too and it was working very well but when I encapsulated that code into widget it is causing error. Is it due to moc? because when I tested before i tested code with all setup in mainwindow it was working fine. The third party widget that I am using in tfwidget uses QGraphicsView. I am still wandering.

Log in to reply