Overview
Comment: | Only call al_*_destroy if Allegro is initialized.
Otherwise, it would crash if al_uinstall_system() has already been |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
4719f257098862d724c5e3cec9f5db35 |
User & Date: | js on 2012-08-26 12:17:52 |
Original User & Date: | js on 2012-08-26 12:17:53 |
Other Links: | manifest | tags |
Context
2012-08-26
| ||
12:17 | Remove ogk_event_type_t, which was unused anyway. check-in: c7c26ea8cf user: js tags: trunk | |
12:17 | Only call al_*_destroy if Allegro is initialized. check-in: 4719f25709 user: js tags: trunk | |
10:09 | Use flags for -[OGKDisplay init...]. check-in: 40c2d53ff0 user: js tags: trunk | |
Changes
Modified src/OGKBitmap.m from [d4949e0576] to [ffce6aad92].
︙ | ︙ | |||
28 29 30 31 32 33 34 | @implementation OGKBitmap + (void)initialize { if (self != [OGKBitmap class]) return; | < | | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | @implementation OGKBitmap + (void)initialize { if (self != [OGKBitmap class]) return; if (!al_init() || !al_init_image_addon()) @throw [OFInitializationFailedException exceptionWithClass: self]; } + (void)setTarget: (id)target { if ([target isKindOfClass: [OGKDisplay class]]) |
︙ | ︙ | |||
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | if (bitmap == NULL) @throw [OFInitializationFailedException exceptionWithClass: [self class]]; return self; } - (void)drawAtPosition: (of_point_t)position { al_draw_bitmap(bitmap, position.x, position.y, 0); } - (ALLEGRO_BITMAP*)OGK_allegroBitmap { return bitmap; } @end | > > > > > > | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | if (bitmap == NULL) @throw [OFInitializationFailedException exceptionWithClass: [self class]]; return self; } - (void)dealloc { if (bitmap != NULL && al_is_system_installed()) al_destroy_bitmap(bitmap); } - (void)drawAtPosition: (of_point_t)position { al_draw_bitmap(bitmap, position.x, position.y, 0); } - (ALLEGRO_BITMAP*)OGK_allegroBitmap { return bitmap; } @end |
Modified src/OGKDisplay.m from [c9b84695dd] to [2b13daa365].
︙ | ︙ | |||
26 27 28 29 30 31 32 | @implementation OGKDisplay + (void)initialize { if (self != [OGKDisplay class]) return; | | | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | @implementation OGKDisplay + (void)initialize { if (self != [OGKDisplay class]) return; if (!al_init()) @throw [OFInitializationFailedException exceptionWithClass: self]; mutex = [[OFMutex alloc] init]; displays = [[OFMutableArray alloc] init]; allegroDisplays = [[OFDataArray alloc] initWithItemSize: sizeof(ALLEGRO_DISPLAY*)]; |
︙ | ︙ | |||
104 105 106 107 108 109 110 | [allegroDisplays removeItemAtIndex: index]; [displays removeObjectAtIndex: index]; } @finally { [mutex unlock]; } | | | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | [allegroDisplays removeItemAtIndex: index]; [displays removeObjectAtIndex: index]; } @finally { [mutex unlock]; } if (display != NULL && al_is_system_installed()) al_destroy_display(display); } - (void)setWindowTitle: (OFString*)title { al_set_window_title(display, [title cStringWithEncoding: OF_STRING_ENCODING_NATIVE]); |
︙ | ︙ |
Modified src/OGKEventQueue.m from [7219e86adc] to [84dbf1da64].
︙ | ︙ | |||
29 30 31 32 33 34 35 | @synthesize delegate; + (void)initialize { if (self != [OGKEventQueue class]) return; | | > | | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | @synthesize delegate; + (void)initialize { if (self != [OGKEventQueue class]) return; if (!al_init()) @throw [OFInitializationFailedException exceptionWithClass: self]; } - init { self = [super init]; eventQueue = al_create_event_queue(); return self; } - (void)dealloc { if (al_is_system_installed()) al_destroy_event_queue(eventQueue); } - (void)handleNextEvent { OGKEvent *event = [[OGKEvent alloc] init]; ALLEGRO_EVENT *allegroEvent = [event OGK_allegroEvent]; |
︙ | ︙ |
Modified test/TestMain.m from [a7dbf6df22] to [28b7846922].
︙ | ︙ | |||
112 113 114 115 116 117 118 | for (running = YES; running;) { @autoreleasepool { [self handleEvents]; [self draw]; } } } | < < < < < < < < < | 112 113 114 115 116 117 118 119 | for (running = YES; running;) { @autoreleasepool { [self handleEvents]; [self draw]; } } } @end |