c++ - Segmentation fault: Calling an Qt object's method from another object's method by pointer -


i have definition of class

class mainwindow : public qmainwindow     { q_object //ignore      private slots:        void on_pushbutton_clicked();      private:        ui::mainwindow *ui;        qtimer* cyclecomplete;     } 

and constructor , member function definitions:

mainwindow::mainwindow(qwidget *parent) :     qmainwindow(parent),     ui(new ui::mainwindow) {     ui->setupui(this);     qtimer* cyclecomplete = new qtimer(this); }  mainwindow::on_pushbutton_clicked() {     cyclecomplete->start(1000); //error: segmentation fault } 

if cyclecomplete->start(1000) method (or function?) called, program crashes without message, or if using debugger, windows sends qt editor (an ide) error says "segmentation fault".

is not allocated correctly? or not allocated @ all? interpretation of code constructor class mainwindow creates object of class qtimer, , pointer stored in mainwindow can call qtimer object's methods (functions?) within mainwindow object's methods (functions?).

sorry programming lingo confusion.


Popular posts from this blog