Segmentation fault(core dumped) occured after add an private member in widget class.
Solved
Mobile and Embedded
-
I am building a tool with QT 5,12 to run in the arm64 board. It run well when there was only one private member. When I add more private members, it can compile successfully, but run to the segmentation fault.
QT_BEGIN_NAMESPACE namespace Ui { class Widget; } QT_END_NAMESPACE class Widget : public QWidget { Q_OBJECT public: Widget(QWidget *parent = nullptr); ~Widget(); QLCDNumber *rebootTimeLcdNum; QTimer *mtimer; private: Ui::Widget *ui; QPushButton *startButton; //QLCDNumber *rebootTimeLcdNum; //QTimer *mtimer; //int a; private slots: void on_startButton_clicked(); void onTimerTimeout(); };
Widget::Widget(QWidget *parent) : QWidget(parent) , ui(new Ui::Widget) { ui->setupUi(this); connect(startButton, SIGNAL(clicked()), this, SLOT(on_startButton_clicked())); }
I use gdb to debug and find that the fault occurred when connecting the slot function on_startButton_clicked() . And the fault won't occur if I put the member to public.
Does anyone experencd the same problem?
-