SIGSEGV on QTabWidget::close
-
Hi there,
I have a problem with proper closing my application without a SIGSEGV.
My window is made of a QTabWidget derived widget. The tabwidget
has four tabs and each has an ordinary qwidget in it.class TabWidget : public QTabWidget { Q_OBJECT public: explicit TabWidget(QTabWidget *parent = Q_NULLPTR);
In one of the tabs qwidget I have a pushbutton that is connected to the tabwidgets
close() function.connect(pbExit,&QPushButton::clicked,this,&TabWidget::close);
If I press the button (or click on the close window cross) the application quits with SIGSEGV:
The program has unexpectedly finished. The process was ended forcefully. /home/paul/store/c++/qt/build-qt-wetter-0.7-Desktop-Debug/qt-wetter-0 crashed.
If I debug the app it shows me the arrow where the error might be but the arrow is pointing at the Tabwidget class declaration itself, how could I debug further to find the problem?
-
Hi,
Do you have any of your widgets on the stack and giving it a parent at the same time ?
-
@VRonin I indeed set that
flagattribute, just to see if that changes something but removing it does not solve it.@SGaist no, the widgets I use for the tabs do not have a parent,
tab1 = new QWidget; tab2 = new QWidget; tab3 = new QWidget; tab4 = new QWidget; this->addTab(tab1,"Sensoren"); this->addTab(tab2,"Regenradar"); this->addTab(tab3, "Graph"); this->addTab(tab4, "System");
I will try to comment out parts of my code to condense the problem
-
That faulty QHBoxLayout has the problem that I added a QSpacerItem (addSpacerItem) to it two times... So I guess that is not the right way to use QSpacerItem? Can it only be added once to a QHBoxLayout?
EDIT:
Normally, you don't need to use this class directly. Qt's built-in layout managers provide the following functions for manipulating empty space in layouts