Index: misc_gui.c =================================================================== --- misc_gui.c (revision 6500) +++ misc_gui.c (working copy) @@ -1318,6 +1318,8 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e) { static FiosItem o_dir; + WindowClass wc; + WindowNumber wn; switch (e->event) { case WE_CREATE: { /* Set up OPENTTD button */ @@ -1461,13 +1463,18 @@ case WE_TIMEOUT: if (HASBIT(w->click_state, 11)) { /* Delete button clicked */ if (!FiosDelete(OTTD2FS(WP(w,querystr_d).text.buf))) { + /* MR 2006-09-26; Restore the w pointer after calling ShowErrorMessage, because window list can change */ + wc = w->window_class; + wn = w->window_number; + ShowErrorMessage(INVALID_STRING_ID, STR_4008_UNABLE_TO_DELETE_FILE, 0, 0); + + w = FindWindowById(wc, wn); } else { BuildFileList(); /* Reset file name to current date on successfull delete */ if (_saveload_mode == SLD_SAVE_GAME) GenerateFileName(); } - UpdateTextBufferSize(&WP(w, querystr_d).text); SetWindowDirty(w); } else if (HASBIT(w->click_state, 12)) { /* Save button clicked */