From 92cc3dbc2a6daa8a102ba90011bf1153dc4286cc Mon Sep 17 00:00:00 2001 From: Brandon Wright Date: Tue, 25 Apr 2017 09:40:36 -0500 Subject: [PATCH] Allocate preferences on the stack to try and fix double free. --- gtk/src/gtk_preferences.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/gtk/src/gtk_preferences.cpp b/gtk/src/gtk_preferences.cpp index 654ba5f5..ec66c495 100644 --- a/gtk/src/gtk_preferences.cpp +++ b/gtk/src/gtk_preferences.cpp @@ -19,21 +19,20 @@ gboolean snes9x_preferences_open (GtkWidget *widget, gpointer data) { - Snes9xPreferences *preferences; Snes9xWindow *window = ((Snes9xWindow *) data); Snes9xConfig *config = window->config; window->pause_from_focus_change (); - preferences = new Snes9xPreferences (config); - gtk_window_set_transient_for (preferences->get_window (), + Snes9xPreferences preferences (config); + gtk_window_set_transient_for (preferences.get_window (), window->get_window ()); #ifdef USE_JOYSTICK config->set_joystick_mode (JOY_MODE_GLOBAL); #endif - preferences->show (); + preferences.show (); window->unpause_from_focus_change (); #ifdef USE_JOYSTICK @@ -43,8 +42,6 @@ snes9x_preferences_open (GtkWidget *widget, config->reconfigure (); window->update_accels (); - delete preferences; - return TRUE; }