diff --git a/src/subs_edit_box.cpp b/src/subs_edit_box.cpp index 4f205c5cb..ca08b4177 100644 --- a/src/subs_edit_box.cpp +++ b/src/subs_edit_box.cpp @@ -96,6 +96,10 @@ void time_edit_char_hook(wxKeyEvent &event) { event.Skip(); } +// Passing a pointer-to-member directly to a function sometimes does not work +// in VC++ 2015 Update 2, with it instead passing a null pointer +const auto AssDialogue_Actor = &AssDialogue::Actor; +const auto AssDialogue_Effect = &AssDialogue::Effect; } SubsEditBox::SubsEditBox(wxWindow *parent, agi::Context *context) @@ -317,10 +321,8 @@ void SubsEditBox::OnCommit(int type) { } if (type == AssFile::COMMIT_NEW) { - // Without this pointless variable vc++ 2015 passes null to PopulateList - auto vs14_u2_workaround = &AssDialogue::Effect; - PopulateList(effect_box, vs14_u2_workaround); - PopulateList(actor_box, vs14_u2_workaround = &AssDialogue::Actor); + PopulateList(effect_box, AssDialogue_Effect); + PopulateList(actor_box, AssDialogue_Actor); return; } else if (type & AssFile::COMMIT_STYLES) @@ -355,11 +357,11 @@ void SubsEditBox::UpdateFields(int type, bool repopulate_lists) { active_style = line ? c->ass->GetStyle(line->Style) : nullptr; style_edit_button->Enable(active_style != nullptr); - if (repopulate_lists) PopulateList(effect_box, &AssDialogue::Effect); + if (repopulate_lists) PopulateList(effect_box, AssDialogue_Effect); effect_box->ChangeValue(to_wx(line->Effect)); effect_box->SetStringSelection(to_wx(line->Effect)); - if (repopulate_lists) PopulateList(actor_box, &AssDialogue::Actor); + if (repopulate_lists) PopulateList(actor_box, AssDialogue_Actor); actor_box->ChangeValue(to_wx(line->Actor)); actor_box->SetStringSelection(to_wx(line->Actor)); } @@ -591,8 +593,8 @@ void SubsEditBox::OnStyleChange(wxCommandEvent &evt) { void SubsEditBox::OnActorChange(wxCommandEvent &evt) { bool amend = evt.GetEventType() == wxEVT_TEXT; - SetSelectedRows(&AssDialogue::Actor, new_value(actor_box, evt), _("actor change"), AssFile::COMMIT_DIAG_META, amend); - PopulateList(actor_box, &AssDialogue::Actor); + SetSelectedRows(AssDialogue_Actor, new_value(actor_box, evt), _("actor change"), AssFile::COMMIT_DIAG_META, amend); + PopulateList(actor_box, AssDialogue_Actor); } void SubsEditBox::OnLayerEnter(wxCommandEvent &evt) { @@ -601,8 +603,8 @@ void SubsEditBox::OnLayerEnter(wxCommandEvent &evt) { void SubsEditBox::OnEffectChange(wxCommandEvent &evt) { bool amend = evt.GetEventType() == wxEVT_TEXT; - SetSelectedRows(&AssDialogue::Effect, new_value(effect_box, evt), _("effect change"), AssFile::COMMIT_DIAG_META, amend); - PopulateList(effect_box, &AssDialogue::Effect); + SetSelectedRows(AssDialogue_Effect, new_value(effect_box, evt), _("effect change"), AssFile::COMMIT_DIAG_META, amend); + PopulateList(effect_box, AssDialogue_Effect); } void SubsEditBox::OnCommentChange(wxCommandEvent &evt) {