From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LOw0x-0005BJ-JW for qemu-devel@nongnu.org; Mon, 19 Jan 2009 10:26:11 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LOw0w-0005Ab-6t for qemu-devel@nongnu.org; Mon, 19 Jan 2009 10:26:10 -0500 Received: from [199.232.76.173] (port=34731 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LOw0v-0005AY-Va for qemu-devel@nongnu.org; Mon, 19 Jan 2009 10:26:10 -0500 Received: from vsmtp04.dti.ne.jp ([202.216.231.139]:40367) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LOw0v-0005oE-Bl for qemu-devel@nongnu.org; Mon, 19 Jan 2009 10:26:09 -0500 Received: from [192.168.1.21] (PPPa1787.e11.eacc.dti.ne.jp [124.255.93.17]) by vsmtp04.dti.ne.jp (3.11v) with ESMTP AUTH id n0JFQ4jX018921 for ; Tue, 20 Jan 2009 00:26:05 +0900 (JST) Message-ID: <49749B91.6080200@juno.dti.ne.jp> Date: Tue, 20 Jan 2009 00:26:09 +0900 From: Shin-ichiro KAWASAKI MIME-Version: 1.0 Subject: Re: [PATCH] Adds null check for DisplayStatus (wasRe: [Qemu-devel] [6344] graphical_console_init change (Stefano Stabellini) References: <4973267B.9010901@juno.dti.ne.jp> <49734152.7080302@juno.dti.ne.jp> <49746680.3070400@eu.citrix.com> In-Reply-To: <49746680.3070400@eu.citrix.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Stefano Stabellini wrote: > Shin-ichiro KAWASAKI wrote: > >> I'm sending the patch which solves the problem above. >> Could anyone evaluate it? >> > > > > Thanks for spotting the bug and your work on a patch! > > However I think the following fix is cleaner: we do not need a > dumb_display_init that creates an empty DisplayChangeListener any more. > We do need a dumb_display_init that allocates a zeroed DisplayState > structure if none else does it. > > Please let me know if it also fixes you problem. It solves my problem finely. Thank you! Tested-by: Shin-ichiro KAWASAKI > Signed-off-by: Stefano Stabellini > > --- > > diff --git a/vl.c b/vl.c > index bfacdcf..63d954b 100644 > --- a/vl.c > +++ b/vl.c > @@ -2775,25 +2775,10 @@ DisplayState *get_displaystate(void) > > /* dumb display */ > > -static void dumb_update(DisplayState *ds, int x, int y, int w, int h) > +static void dumb_display_init(void) > { > -} > - > -static void dumb_resize(DisplayState *ds) > -{ > -} > - > -static void dumb_display_init(DisplayState *ds) > -{ > - DisplayChangeListener *dcl = qemu_mallocz(sizeof(DisplayChangeListener)); > - if (!dcl) > - exit(1); > - dcl->dpy_update = dumb_update; > - dcl->dpy_resize = dumb_resize; > - dcl->dpy_refresh = NULL; > - dcl->idle = 1; > - dcl->gui_timer_interval = 500; > - register_displaychangelistener(ds, dcl); > + DisplayState *ds = qemu_mallocz(sizeof(DisplayState)); > + register_displaystate(ds); > } > > /***********************************************************/ > @@ -5535,6 +5520,8 @@ int main(int argc, char **argv, char **envp) > } > } > > + if (!display_state) > + dumb_display_init(); > /* just use the first displaystate for the moment */ > ds = display_state; > /* terminal init */ > @@ -5543,8 +5530,6 @@ int main(int argc, char **argv, char **envp) > fprintf(stderr, "fatal: -nographic can't be used with -curses\n"); > exit(1); > } > - /* nearly nothing to do */ > - dumb_display_init(ds); > } else { > #if defined(CONFIG_CURSES) > if (curses) { > @@ -5563,8 +5548,6 @@ int main(int argc, char **argv, char **envp) > sdl_display_init(ds, full_screen, no_frame); > #elif defined(CONFIG_COCOA) > cocoa_display_init(ds, full_screen); > -#else > - dumb_display_init(ds); > #endif > } > } > > > > >