Re: [AD] 4.9 shutdown bug

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


On 12/1/07, Peter Wang <novalazy@xxxxxxxxxx> wrote:
> _al_exit() calls al_set_current_display(NULL);
>
> void al_set_current_display(ALLEGRO_DISPLAY *display)
> {
>    if (display)
>       display->vt->set_current_display(display);
>
>    if ((tls = tls_get()) == NULL)
>       return;
>    tls->current_display = display;
>
>    al_set_target_bitmap(al_get_backbuffer());
> }
>
> But at the time al_get_backbuffer() is called, _al_current_display will
> be NULL so it crashes.  It wasn't obvious to me how it's intended to
> work so I leave it to someone else :)

Changed to:

void al_set_current_display(ALLEGRO_DISPLAY *display)
{
   if ((tls = tls_get()) == NULL)
      return;
   tls->current_display = display;

   if (display) {
      display->vt->set_current_display(display);
      al_set_target_bitmap(al_get_backbuffer());
   }
}




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