QStateMachine segmentation fault



  • Hi guys,

    I've been using QStateMachine to controll a machine process. This is the code:

    this->dispenserCycleFsm = new QStateMachine(this);
    
        //general dispenser state machine
        LOGINFO("Inizializzazione macchina a stati del dispenser");
    
        cycling=new DispenserState(tr("cycling"),dispenserData);
        stopped = new QFinalState();
        finished = new QFinalState();
        /*
        stopped = new DispenserFinalState(tr("stopped"),dispenserData);
        finished = new DispenserFinalState(tr("finished"),dispenserData);
        */
        cycling_movingRequest=new TurnstileMovingState(tr("moving request"),dispenserData,cycling);
        cycling_fcInCheckDelay = new TimerState(tr("fcIn check delay"),Params::Instance()->CYCLE_FCIN_DELAY,dispenserData,cycling);
        cycling_waitingFcIn=new TurnstileStoppedOnExit(tr("waitingFcIn"),dispenserData,cycling);
        cycling_waitProductOut=new DispenserState(tr("waitProductOut"),dispenserData,cycling);
        cycling->setInitialState(cycling_movingRequest);
    
    
        connect(stopped,SIGNAL(stateChanged(QString)),this,SLOT(setDispenserStateString(QString)));
        connect(cycling_movingRequest,SIGNAL(stateChanged(QString)),this,SLOT(setDispenserStateString(QString)));
        connect(cycling_fcInCheckDelay,SIGNAL(stateChanged(QString)),this,SLOT(setDispenserStateString(QString)));
        connect(cycling_waitingFcIn,SIGNAL(stateChanged(QString)),this,SLOT(setDispenserStateString(QString)));
        connect(cycling_waitProductOut,SIGNAL(stateChanged(QString)),this,SLOT(setDispenserStateString(QString)));
        connect(finished,SIGNAL(stateChanged(QString)),this,SLOT(setDispenserStateString(QString)));
    
        //condizioni di stop
        cycling->addTransition(new SignalTransition("",this,SIGNAL(stopTurnstile()),stopped));
        connect(stopped,SIGNAL(entered()),this,SLOT(cycleStop()));
    
        cycling_movingRequest->addTransition(new OutputOnTransition(dispenserData.hwBoardAddress,dispenserData.motorOut,"out on",cycling_fcInCheckDelay));
        cycling_fcInCheckDelay->addTransition(new SignalTransition("",cycling_fcInCheckDelay,SIGNAL(triggerd()),cycling_waitingFcIn));
        cycling_waitingFcIn->addTransition(new InputOnTransition(dispenserData.hwBoardAddress,dispenserData.fcIn,"fc on",cycling_waitProductOut));
    
        cycling_waitProductOut->addTransition(new InputOffTransition(dispenserData.vuBoardAddress,dispenserData.outputFcIn," out fc off",finished));
        cycling_waitProductOut->addTransition(new InputOffTransition(dispenserData.vuBoardAddress2,dispenserData.outputFcIn2," out fc off",finished));
        cycling_waitProductOut->addTransition(new SignalTransition("",this,SIGNAL(forceCycleEnd()),finished));
    
        connect(cycling_waitProductOut,SIGNAL(entered()),this,SLOT(checkForceCycleEnd()));
    
        connect(finished,SIGNAL(entered()),this,SLOT(cycleEnd()));
    
        dispenserCycleFsm->addState(stopped);
        dispenserCycleFsm->addState(cycling);
        dispenserCycleFsm->addState(finished);
        dispenserCycleFsm->setInitialState(cycling);
    

    but sometimes I have a segmentation fault when the QFinalState is reached.

    Segmentation Stack Trace

    I'm using qt 4.8.

    Thanks to all


  • Lifetime Qt Champion

    Hi,

    You should run your application and then post the backtrace here.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.