From c33f09b2d8772874ec8759f7c406e8dc5d34c27c Mon Sep 17 00:00:00 2001 From: gbeauche <> Date: Wed, 22 Jun 2005 16:40:24 +0000 Subject: [PATCH] Fix crash in FBDev DGA mode when it failed to initialize (here, that was because fb visual was Direct Color instead of True Color). We used to initialize the_buffer* even if !open_display. Report that gracefully with the dedicated STR_OPEN_WINDOW_ERR. --- SheepShaver/src/Unix/video_x.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/SheepShaver/src/Unix/video_x.cpp b/SheepShaver/src/Unix/video_x.cpp index a9647978..98305be1 100644 --- a/SheepShaver/src/Unix/video_x.cpp +++ b/SheepShaver/src/Unix/video_x.cpp @@ -1023,8 +1023,10 @@ static bool open_display(void) #endif // Zero screen buffers, viRowBytes is initialized at this stage - memset(the_buffer, 0, VModes[cur_mode].viRowBytes * VModes[cur_mode].viYsize); - memset(the_buffer_copy, 0, VModes[cur_mode].viRowBytes * VModes[cur_mode].viYsize); + if (display_open) { + memset(the_buffer, 0, VModes[cur_mode].viRowBytes * VModes[cur_mode].viYsize); + memset(the_buffer_copy, 0, VModes[cur_mode].viRowBytes * VModes[cur_mode].viYsize); + } return display_open; } @@ -1643,8 +1645,10 @@ bool VideoInit(void) #endif // Open window/screen - if (!open_display()) + if (!open_display()) { + ErrorAlert(GetString(STR_OPEN_WINDOW_ERR)); return false; + } #if 0 // Ignore errors from now on