Commit e46eb583 authored by ROOL's avatar ROOL 🤖
Browse files

Fix for crash double clicking in sprite window

Detail:
  Making 1 new sprite and repeatedly double clicking on it in the sprite window
  would cause a fatal internal error. A bug introduced in Paint 2.24 was not
  checking whether the tag was a window before proceeding.
Admin:
  Submission for Paint bounty.

Version 2.48. Tagged as 'Paint-2_48'
parent 2808798d
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
GBLS Module_ApplicationDate GBLS Module_ApplicationDate
GBLS Module_HelpVersion GBLS Module_HelpVersion
GBLS Module_ComponentName GBLS Module_ComponentName
Module_MajorVersion SETS "2.47" Module_MajorVersion SETS "2.48"
Module_Version SETA 247 Module_Version SETA 248
Module_MinorVersion SETS "" Module_MinorVersion SETS ""
Module_Date SETS "06 Apr 2022" Module_Date SETS "12 Sep 2022"
Module_ApplicationDate SETS "06-Apr-22" Module_ApplicationDate SETS "12-Sep-22"
Module_ComponentName SETS "Paint" Module_ComponentName SETS "Paint"
Module_FullVersion SETS "2.47" Module_FullVersion SETS "2.48"
Module_HelpVersion SETS "2.47 (06 Apr 2022)" Module_HelpVersion SETS "2.48 (12 Sep 2022)"
END END
/* (2.47) /* (2.48)
* *
* This file is automatically maintained by srccommit, do not edit manually. * This file is automatically maintained by srccommit, do not edit manually.
* *
*/ */
#define Module_MajorVersion_CMHG 2.47 #define Module_MajorVersion_CMHG 2.48
#define Module_MinorVersion_CMHG #define Module_MinorVersion_CMHG
#define Module_Date_CMHG 06 Apr 2022 #define Module_Date_CMHG 12 Sep 2022
#define Module_MajorVersion "2.47" #define Module_MajorVersion "2.48"
#define Module_Version 247 #define Module_Version 248
#define Module_MinorVersion "" #define Module_MinorVersion ""
#define Module_Date "06 Apr 2022" #define Module_Date "12 Sep 2022"
#define Module_ApplicationDate "06-Apr-22" #define Module_ApplicationDate "12-Sep-22"
#define Module_ComponentName "Paint" #define Module_ComponentName "Paint"
#define Module_FullVersion "2.47" #define Module_FullVersion "2.48"
#define Module_HelpVersion "2.47 (06 Apr 2022)" #define Module_HelpVersion "2.48 (12 Sep 2022)"
#define Module_LibraryVersionInfo "2:47" #define Module_LibraryVersionInfo "2:48"
...@@ -1884,7 +1884,7 @@ void main_clear_other_selections(main_window *window) ...@@ -1884,7 +1884,7 @@ void main_clear_other_selections(main_window *window)
main_window *ptr; main_window *ptr;
for (ptr = main_windows; ptr != NULL; ptr = ptr->link) for (ptr = main_windows; ptr != NULL; ptr = ptr->link)
if (ptr != window && ptr->selection.count > 0) if (ptr != window && ptr->tag == main_window_is_file && ptr->selection.count > 0)
main_clear_all (ptr); main_clear_all (ptr);
} }
...@@ -1946,7 +1946,9 @@ static void main_clear_selection (main_window *window, wimp_box *clip, select_ic ...@@ -1946,7 +1946,9 @@ static void main_clear_selection (main_window *window, wimp_box *clip, select_ic
int column, spritesperrow; int column, spritesperrow;
int left, top; int left, top;
if (!window || (window->selection.count==0 && how == SI_CLEAR)) return; if (!window || (window->tag != main_window_is_file) ||
(window->selection.count == 0 && how == SI_CLEAR))
return;
if (!clip) clip = &defclip; if (!clip) clip = &defclip;
......
...@@ -1548,6 +1548,8 @@ void sprwindow_new (main_sprite *sprite) ...@@ -1548,6 +1548,8 @@ void sprwindow_new (main_sprite *sprite)
window->handle = w; window->handle = w;
window->tag = main_window_is_sprite; window->tag = main_window_is_sprite;
window->data = (main_info_block *) sprite_window; window->data = (main_info_block *) sprite_window;
/*Selection's currently for file windows but clear it for safety anyway*/
memset (&window->selection, 0, sizeof(window->selection));
sprwindow_set_window_titles (sprite); sprwindow_set_window_titles (sprite);
sprwindow_set_work_extent (window, TRUE); sprwindow_set_work_extent (window, TRUE);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment