diff --git a/radiant/error.cpp b/radiant/error.cpp index 41c0ab4..19614a5 100644 --- a/radiant/error.cpp +++ b/radiant/error.cpp @@ -112,16 +112,24 @@ void Error (const char *error, ...) } } - strcat (text, "An unrecoverable error has occured.\n" - "Would you like to edit Preferences before exiting Radiant?"); + strcat (text, "An unrecoverable error has occured.\n"); - Sys_Printf(text); + if (!g_PrefsDlg.isInitialized()) { - if (gtk_MessageBox(NULL, text, "Error", MB_YESNO) == IDYES) - { - Sys_Printf("Doing prefs..\n"); - g_PrefsDlg.LoadPrefs (); - g_PrefsDlg.DoModal(); + gtk_MessageBox(NULL, text, "Error", MB_OK); + + } else { + + strcat(text, "Would you like to edit Preferences before exiting Radiant?"); + + Sys_Printf(text); + + if (gtk_MessageBox(NULL, text, "Error", MB_YESNO) == IDYES) + { + Sys_Printf("Doing prefs..\n"); + g_PrefsDlg.LoadPrefs (); + g_PrefsDlg.DoModal(); + } } QGL_Shutdown(); diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index 8e0e594..49ccce7 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -603,6 +603,7 @@ static void OnButtonClean (GtkWidget *widget, gpointer data) // profile_load_int takes an argument to use if the value is not found PrefsDlg::PrefsDlg () { + m_bIsInitialized = FALSE; m_bWarn = TRUE; m_nMouse = 1; m_nView = MainFrame::eRegular; @@ -1507,6 +1508,7 @@ void PrefsDlg::Init() m_rc_path = g_string_new (g_strGameToolsPath.GetBuffer() ); m_inipath = g_string_new (m_rc_path->str); g_string_append (m_inipath, PREFS_LOCAL_FILENAME); + m_bIsInitialized = true; return; } #endif @@ -1521,7 +1523,7 @@ void PrefsDlg::Init() // then the ini file m_inipath = g_string_new (m_rc_path->str); g_string_append (m_inipath, PREFS_LOCAL_FILENAME); - + m_bIsInitialized = true; } void PrefsDlg::UpdateData (bool retrieve) @@ -2844,6 +2846,11 @@ void PrefsDlg::LoadPrefs () { int i; + if (!isInitialized()) { + Sys_Printf("PrefsDlg::LoadPrefs() called without being initialized, leaving\n"); + return; + } + // first things first, load prefs from global prefs mGamesDialog.LoadPrefs(); @@ -3245,6 +3252,10 @@ void PrefsDlg::DoSensitivity() } } +bool PrefsDlg::isInitialized() +{ + return m_bIsInitialized; +} /* ============================================================ CGameInstall diff --git a/radiant/preferences.h b/radiant/preferences.h index d48b117..1de1d5a 100644 --- a/radiant/preferences.h +++ b/radiant/preferences.h @@ -458,10 +458,12 @@ class PrefsDlg : public Dialog this holds global level preferences */ CGameDialog mGamesDialog; + bool isInitialized(); protected: // warning about old project files bool m_bWarn; list mGames; + bool m_bIsInitialized; public: // last light intensity used in the CLightPrompt dialog, stored in registry