Copy string options rather than referencing them
This can lead to dandling references, though this is very unlikely. This commit also removes a useless check.
This commit is contained in:
parent
e76cef79d2
commit
2b8f9f71ff
|
@ -126,7 +126,7 @@ static void toggleBitVar(bool *menuValue, int *globalVar, int mask)
|
|||
EVT_HANDLER(wxID_OPEN, "Open ROM...")
|
||||
{
|
||||
static int open_ft = 0;
|
||||
const wxString& gba_rom_dir = OPTION(kGBAROMDir);
|
||||
const wxString gba_rom_dir = OPTION(kGBAROMDir);
|
||||
|
||||
// FIXME: ignore if non-existent or not a dir
|
||||
wxString pats = _(
|
||||
|
@ -158,7 +158,7 @@ EVT_HANDLER(wxID_OPEN, "Open ROM...")
|
|||
EVT_HANDLER(OpenGB, "Open GB...")
|
||||
{
|
||||
static int open_ft = 0;
|
||||
const wxString& gb_rom_dir = OPTION(kGBROMDir);
|
||||
const wxString gb_rom_dir = OPTION(kGBROMDir);
|
||||
|
||||
// FIXME: ignore if non-existent or not a dir
|
||||
wxString pats = _(
|
||||
|
@ -185,7 +185,7 @@ EVT_HANDLER(OpenGB, "Open GB...")
|
|||
EVT_HANDLER(OpenGBC, "Open GBC...")
|
||||
{
|
||||
static int open_ft = 0;
|
||||
const wxString& gbc_rom_dir = OPTION(kGBGBCROMDir);
|
||||
const wxString gbc_rom_dir = OPTION(kGBGBCROMDir);
|
||||
|
||||
// FIXME: ignore if non-existent or not a dir
|
||||
wxString pats = _(
|
||||
|
|
|
@ -330,7 +330,7 @@ void DisplayConfig::PopulatePluginOptions() {
|
|||
plugin_selector_->Clear();
|
||||
plugin_selector_->Append(_("None"), new wxStringClientData());
|
||||
|
||||
const wxString& selected_plugin = OPTION(kDispFilterPlugin);
|
||||
const wxString selected_plugin = OPTION(kDispFilterPlugin);
|
||||
bool is_plugin_selected = false;
|
||||
|
||||
for (const wxString& plugin : plugins) {
|
||||
|
|
|
@ -56,11 +56,8 @@ bool SpeedupConfigValidator::TransferToWindow() {
|
|||
|
||||
bool SpeedupConfigValidator::TransferFromWindow() {
|
||||
auto dialog = static_cast<SpeedupConfig*>(GetWindow());
|
||||
|
||||
uint32_t val = dialog->speedup_throttle_spin_->GetValue();
|
||||
|
||||
VBAM_CHECK(val >= 0);
|
||||
|
||||
if (val == 0) {
|
||||
OPTION(kPrefSpeedupThrottle) = 0;
|
||||
OPTION(kPrefSpeedupFrameSkip) = 0;
|
||||
|
@ -116,11 +113,8 @@ SpeedupConfig::SpeedupConfig(wxWindow* parent)
|
|||
void SpeedupConfig::SetSpeedupThrottle(wxCommandEvent& evt)
|
||||
{
|
||||
VBAM_CHECK(evt.GetEventObject() == speedup_throttle_spin_);
|
||||
|
||||
uint32_t val = speedup_throttle_spin_->GetValue();
|
||||
|
||||
VBAM_CHECK(val >= 0);
|
||||
|
||||
if (val == 0) {
|
||||
frame_skip_cb_->SetValue(false);
|
||||
frame_skip_cb_->Disable();
|
||||
|
|
|
@ -189,19 +189,19 @@ void GameArea::LoadGame(const wxString& name)
|
|||
wxString rp = fnfn.GetPath();
|
||||
|
||||
// can't really decide which dir to use, so try GBA first, then GB
|
||||
const wxString& gba_rom_dir = OPTION(kGBAROMDir);
|
||||
const wxString gba_rom_dir = OPTION(kGBAROMDir);
|
||||
if (!wxGetApp().GetAbsolutePath(gba_rom_dir).empty()) {
|
||||
fnfn.SetPath(wxGetApp().GetAbsolutePath(gba_rom_dir) + '/' + rp);
|
||||
badfile = !fnfn.IsFileReadable();
|
||||
}
|
||||
|
||||
const wxString& gb_rom_dir = OPTION(kGBROMDir);
|
||||
const wxString gb_rom_dir = OPTION(kGBROMDir);
|
||||
if (badfile && !wxGetApp().GetAbsolutePath(gb_rom_dir).empty()) {
|
||||
fnfn.SetPath(wxGetApp().GetAbsolutePath(gb_rom_dir) + '/' + rp);
|
||||
badfile = !fnfn.IsFileReadable();
|
||||
}
|
||||
|
||||
const wxString& gbc_rom_dir = OPTION(kGBGBCROMDir);
|
||||
const wxString gbc_rom_dir = OPTION(kGBGBCROMDir);
|
||||
if (badfile && !wxGetApp().GetAbsolutePath(gbc_rom_dir).empty()) {
|
||||
fnfn.SetPath(wxGetApp().GetAbsolutePath(gbc_rom_dir) + '/' + rp);
|
||||
badfile = !fnfn.IsFileReadable();
|
||||
|
|
Loading…
Reference in New Issue