Re: [AD] win_set_window problem?

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> It seems win_set_window, if called with NULL or being reinitialized, may 
> cause certain parts of Allegro to be initialized when they're not 
> supposed to. The problem is here:
> 
> static void exit_window_modules(struct WINDOW_MODULES *wm)
> {
>     if (wm)
>        memset(wm, 0, sizeof(wm));
>     ...
> }
> 
> This will only zero-out the first four bytes of the structure and may 
> leave certain parts non-zero (and thus later reinitialize portions of 
> Allegro that shouldn't be). The attached patch 0's it all out.

Shouldn't that preferably be

if (wm)
   memset(wm, 0, sizeof *wm);

?

I think this is what other parts of Allegro use; besides, I think it looks 
nicer :)

Evert





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/