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:
parent
c2baff8cd6
commit
f32ef7ee28
4 changed files with 12 additions and 15 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue