back to scratko.xyz
aboutsummaryrefslogtreecommitdiff
path: root/menu_callbacks.cpp
diff options
context:
space:
mode:
authorscratko <m@scratko.xyz>2024-11-21 00:42:10 +0300
committerscratko <m@scratko.xyz>2024-11-21 00:50:56 +0300
commit0b72fabadec642dcecfe861c56dfeddb0c82a898 (patch)
tree76d8a003db2c45bd0a94753ab921fc07d080f970 /menu_callbacks.cpp
parent503e7350fa3d8065e2f4814181664382154dc702 (diff)
downloadpicture-puzzle-0b72fabadec642dcecfe861c56dfeddb0c82a898.tar.gz
picture-puzzle-0b72fabadec642dcecfe861c56dfeddb0c82a898.tar.bz2
picture-puzzle-0b72fabadec642dcecfe861c56dfeddb0c82a898.zip
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
Diffstat (limited to 'menu_callbacks.cpp')
-rw-r--r--menu_callbacks.cpp4
1 files changed, 3 insertions, 1 deletions
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 <FL/Fl.H>
#include <FL/Fl_Native_File_Chooser.H>
#include <FL/fl_message.H>
#include <memory>
@@ -11,6 +12,7 @@
void new_game_callback(Fl_Widget*, void *gp)
{
+ Fl::check();
PuzzleGame::StartGame(reinterpret_cast<GameParams*>(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