mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2024-12-05 00:38:00 +01:00
don't rely on the game name string pointer to be valid for a whole lifetime
This commit is contained in:
parent
cdc99444e0
commit
6d7007b39e
2 changed files with 3 additions and 2 deletions
|
@ -52,7 +52,7 @@ static char* GetDefaultWindowHeight(struct Game* game) {
|
|||
SYMBOL_EXPORT struct Game* libsuperderpy_init(int argc, char** argv, const char* name, struct Params params) {
|
||||
struct Game* game = calloc(1, sizeof(struct Game));
|
||||
|
||||
game->_priv.name = name;
|
||||
game->_priv.name = strdup(name);
|
||||
game->_priv.params = params;
|
||||
|
||||
#ifdef ALLEGRO_MACOSX
|
||||
|
@ -516,6 +516,7 @@ SYMBOL_EXPORT void libsuperderpy_destroy(struct Game* game) {
|
|||
al_uninstall_system();
|
||||
char** argv = game->_priv.argv;
|
||||
bool restart = game->_priv.restart;
|
||||
free(game->_priv.name);
|
||||
free(game);
|
||||
if (restart) {
|
||||
#ifdef ALLEGRO_MACOSX
|
||||
|
|
|
@ -242,7 +242,7 @@ struct Game {
|
|||
|
||||
ALLEGRO_MUTEX* mutex;
|
||||
|
||||
const char* name;
|
||||
char* name;
|
||||
|
||||
bool shutting_down; /*!< If true then shut down of the game is pending. */
|
||||
bool restart; /*!< If true then restart of the game is pending. */
|
||||
|
|
Loading…
Reference in a new issue