Only call al_*_destroy if Allegro is initialized.

Otherwise, it would crash if al_uinstall_system() has already been
called. Handling it this way eliminates the need to dealloc all objects
before calling al_uninstall_system(), which meant that it was the users
repsonsibility to call al_uninstall_system() after the user made sure
all objects are deallocated. Now the user does not get to see any
al_*() function.
This commit is contained in:
Jonathan Schleifer 2012-08-26 13:29:53 +02:00
parent c2baff8cd6
commit f32ef7ee28
4 changed files with 12 additions and 15 deletions

View file

@ -30,7 +30,7 @@ static OFDataArray *allegroDisplays = nil;
if (self != [OGKDisplay class])
return;
if (!al_install_system(ALLEGRO_VERSION_INT, NULL))
if (!al_init())
@throw [OFInitializationFailedException
exceptionWithClass: self];
@ -108,7 +108,7 @@ static OFDataArray *allegroDisplays = nil;
[mutex unlock];
}
if (display != NULL)
if (display != NULL && al_is_system_installed())
al_destroy_display(display);
}