Hi Jeremie,
To stop the analysis, all we need to do is to kill the process (m_cppcheckProcess->Terminate()) or we can simply clear the m_filelist member so it will stop once it will finish processing the current file.
I prefer to kill the process, since it will be restarted but it will also provide the user with an immediate response with no need to wait
jfouche wrote:m_cppcheckProcess->Terminate();doesn't kill the process
It does. But it is automatically restarted by the plugin (check CppCheckPlugin::OnCppCheckTerminated):
Code: Select all
void CppCheckPlugin::OnCppCheckTerminated(wxProcessEvent& e)
{
if ( GetCanRestart() ) {
wxUnusedVar(e);
m_cppcheckProcess->Disconnect(m_cppcheckProcess->GetUid(), wxEVT_END_PROCESS, wxProcessEventHandler(CppCheckPlugin::OnCppCheckTerminated), NULL, this);
StartCppCheckDaemon();
}
}
As you can see the plugin is also acting as watchdog, in case the process is terminated - it will be restarted.
To really shut it down, you need to call:
Code: Select all
SetCanRestart( false );
m_cppcheckProcess->Terminate();
But the above code should be used only in the UnPlug() method. Since in the other cases, we want the cppcheck daemon up.
jfouche wrote:[edit] : I modified a little bit your fbp in order to add a status line. Unfortunatly, the CPPCheckerReply::StatusMessage is never sent, probably due to the fact that you send files to codelite_cppcheck one by one. Nevermind for the moment.
Actually it is an advantage, since we know exactly how long is the progress bar, and when OnReport() is called, we can add +1 to the progress
Eran