Fix crash after cancelling the shift times dialog. Closes #1483.

Originally committed to SVN as r6756.
This commit is contained in:
Thomas Goyne 2012-05-10 14:18:54 +00:00
parent f724abd0b8
commit 47fb50d4d3
2 changed files with 10 additions and 16 deletions

View File

@ -193,13 +193,22 @@ DialogShiftTimes::DialogShiftTimes(agi::Context *context)
CenterOnParent();
Bind(wxEVT_COMMAND_BUTTON_CLICKED, &DialogShiftTimes::Process, this, wxID_OK);
Bind(wxEVT_COMMAND_BUTTON_CLICKED, &DialogShiftTimes::OnClose, this, wxID_CANCEL);
Bind(wxEVT_COMMAND_BUTTON_CLICKED, std::tr1::bind(&HelpButton::OpenPage, "Shift Times"), wxID_HELP);
history_box->Bind(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, &DialogShiftTimes::OnHistoryClick, this);
context->selectionController->AddSelectionListener(this);
}
DialogShiftTimes::~DialogShiftTimes() {
long shift;
shift_frames->GetValue().ToLong(&shift);
OPT_SET("Tool/Shift Times/Time")->SetInt(shift_time->GetTime());
OPT_SET("Tool/Shift Times/Frames")->SetInt(shift);
OPT_SET("Tool/Shift Times/ByTime")->SetBool(shift_by_time->GetValue());
OPT_SET("Tool/Shift Times/Type")->SetInt(time_fields->GetSelection());
OPT_SET("Tool/Shift Times/Affect")->SetInt(selection_mode->GetSelection());
OPT_SET("Tool/Shift Times/Direction")->SetBool(shift_backward->GetValue());
context->selectionController->RemoveSelectionListener(this);
}
@ -235,20 +244,6 @@ void DialogShiftTimes::OnClear(wxCommandEvent &) {
history->clear();
}
void DialogShiftTimes::OnClose(wxCommandEvent &) {
long shift;
shift_frames->GetValue().ToLong(&shift);
OPT_SET("Tool/Shift Times/Time")->SetInt(shift_time->GetTime());
OPT_SET("Tool/Shift Times/Frames")->SetInt(shift);
OPT_SET("Tool/Shift Times/ByTime")->SetBool(shift_by_time->GetValue());
OPT_SET("Tool/Shift Times/Type")->SetInt(time_fields->GetSelection());
OPT_SET("Tool/Shift Times/Affect")->SetInt(selection_mode->GetSelection());
OPT_SET("Tool/Shift Times/Direction")->SetBool(shift_backward->GetValue());
Destroy();
}
void DialogShiftTimes::OnByTime(wxCommandEvent &) {
shift_time->Enable(true);
shift_frames->Enable(false);

View File

@ -74,7 +74,6 @@ class DialogShiftTimes : public wxDialog, private SelectionListener<AssDialogue>
int Shift(int initial_time, int shift, bool by_time, agi::vfr::Time type);
void OnClear(wxCommandEvent&);
void OnClose(wxCommandEvent&);
void OnByTime(wxCommandEvent&);
void OnByFrames(wxCommandEvent&);
void OnHistoryClick(wxCommandEvent&);