Fix infinite pause when cloning program with errors, closes #837
parent
3472ec6613
commit
73be03161f
|
@ -275,7 +275,7 @@ bool CObjectInterface::EventProcess(const Event &event)
|
|||
}
|
||||
if( action == EVENT_STUDIO_CLONE )
|
||||
{
|
||||
StopEditScript(false);
|
||||
StopEditScript(true);
|
||||
Program* newProgram = m_programStorage->CloneProgram(m_programStorage->GetProgram(m_selScript));
|
||||
m_selScript = m_programStorage->GetProgramIndex(newProgram);
|
||||
m_main->SaveOneScript(m_object);
|
||||
|
@ -738,12 +738,12 @@ void CObjectInterface::StartEditScript(Program* program, std::string name)
|
|||
|
||||
// End of editing a program.
|
||||
|
||||
void CObjectInterface::StopEditScript(bool bCancel)
|
||||
void CObjectInterface::StopEditScript(bool closeWithErrors)
|
||||
{
|
||||
if ( !m_studio->StopEditScript(bCancel) ) return;
|
||||
if ( !m_studio->StopEditScript(closeWithErrors) ) return;
|
||||
m_studio.reset();
|
||||
|
||||
if ( !bCancel ) m_programStorage->SetActiveVirus(false);
|
||||
if ( !closeWithErrors ) m_programStorage->SetActiveVirus(false);
|
||||
|
||||
CreateInterface(true); // puts the control buttons
|
||||
}
|
||||
|
|
|
@ -64,8 +64,19 @@ public:
|
|||
protected:
|
||||
bool EventFrame(const Event &event);
|
||||
|
||||
/**
|
||||
* \brief Start the program editor
|
||||
* \param program Program instance to edit
|
||||
* \param name Program name, used only if the program is empty to insert main function stub code
|
||||
* \remarks If the editor is already open, the behaviour is undefined
|
||||
*/
|
||||
void StartEditScript(Program* program, std::string name);
|
||||
void StopEditScript(bool bCancel);
|
||||
/**
|
||||
* \brief Close the program editor
|
||||
* \param closeWithErrors If true, the editor will be forced to close even if the program contains errors
|
||||
* \remarks If the editor isn't open, the behaviour is undefined
|
||||
*/
|
||||
void StopEditScript(bool closeWithErrors);
|
||||
|
||||
void GroundFlat();
|
||||
void ColorFlag(int color);
|
||||
|
|
|
@ -875,7 +875,7 @@ void CStudio::AdjustEditScript()
|
|||
|
||||
// Ends edition of a program.
|
||||
|
||||
bool CStudio::StopEditScript(bool bCancel)
|
||||
bool CStudio::StopEditScript(bool closeWithErrors)
|
||||
{
|
||||
CWindow* pw;
|
||||
CEdit* edit;
|
||||
|
@ -883,7 +883,7 @@ bool CStudio::StopEditScript(bool bCancel)
|
|||
pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW3));
|
||||
if ( pw == nullptr ) return false;
|
||||
|
||||
if ( !bCancel && !m_script->IsRunning() )
|
||||
if ( !closeWithErrors && !m_script->IsRunning() )
|
||||
{
|
||||
edit = static_cast< CEdit* >(pw->SearchControl(EVENT_STUDIO_EDIT));
|
||||
if ( edit != nullptr )
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
bool EventProcess(const Event &event);
|
||||
|
||||
void StartEditScript(CScript *script, std::string name, Program* program);
|
||||
bool StopEditScript(bool bCancel);
|
||||
bool StopEditScript(bool closeWithErrors);
|
||||
|
||||
void SetInfoText(std::string text, bool bClickable);
|
||||
|
||||
|
|
Loading…
Reference in New Issue