liballeg / allegro5

The official Allegro 5 git repository. Pull requests welcome!
https://liballeg.org
Other
1.9k stars 285 forks source link

Incorrect handling of the new window title with an ALLEGRO_STATE #1562

Closed alemart closed 5 months ago

alemart commented 5 months ago

The new window title is incorrectly stored in and restored from an ALLEGRO_STATE.

Example

#include <stdio.h>
#include <allegro5/allegro5.h>

int main()
{
    ALLEGRO_STATE state;

    if(!al_init())
        return 1;

    al_set_new_window_title("bugs bunny");
    puts(al_get_new_window_title());

    al_store_state(&state, ALLEGRO_STATE_NEW_DISPLAY_PARAMETERS);

    al_set_new_window_title("test");
    puts(al_get_new_window_title());

    al_restore_state(&state);

    puts(al_get_new_window_title());

    return 0;
}

Expected output

bugs bunny
test
bugs bunny

Actual output

bugs bunny
test
bug