From 0b72fabadec642dcecfe861c56dfeddb0c82a898 Mon Sep 17 00:00:00 2001 From: scratko Date: Thu, 21 Nov 2024 00:42:10 +0300 Subject: Fixed memory leak The image widget is responsible for deleting the loaded part of the image Check for correct type of selected file Error checking after image upload --- menu_callbacks.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'menu_callbacks.cpp') diff --git a/menu_callbacks.cpp b/menu_callbacks.cpp index ffc1aae..5668c67 100644 --- a/menu_callbacks.cpp +++ b/menu_callbacks.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -11,6 +12,7 @@ void new_game_callback(Fl_Widget*, void *gp) { + Fl::check(); PuzzleGame::StartGame(reinterpret_cast(gp)); } @@ -30,7 +32,7 @@ void load_file_callback(Fl_Widget *sender, void*) dialog.type(Fl_Native_File_Chooser::BROWSE_FILE); dialog.filter("JPEG Files\t*.jpg\nPNG Files\t*.png"); #if defined(_WIN32) - dialog.directory((string {getenv("HOMEPATH")} + "\\Desktop").c_str()); + dialog.directory((std::string {getenv("HOMEPATH")} + "\\Desktop").c_str()); #else dialog.directory((std::string {getenv("HOME")} + "/Desktop").c_str()); #endif -- cgit v1.2.3