summaryrefslogtreecommitdiff
path: root/src/Fl_cocoa.mm
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2026-01-22 14:27:13 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2026-01-22 14:27:13 +0100
commit05a3f82a5c385e7f00aa2bb8c1971e1cc99225a3 (patch)
tree6d9a37921c572d108b9ff75f5728e9a1654b1306 /src/Fl_cocoa.mm
parent14a5f705c8e3385a637be3377f0800b30c38e589 (diff)
Fix "Setting window custom cursor from SVG image crashes" (#1363)
Diffstat (limited to 'src/Fl_cocoa.mm')
-rw-r--r--src/Fl_cocoa.mm6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index 66d5227fd..7f12390d2 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -4161,6 +4161,11 @@ int Fl_Cocoa_Window_Driver::set_cursor(const Fl_RGB_Image *image, int hotx, int
if ((hoty < 0) || (hoty >= image->h()))
return 0;
+ if (image->as_svg_image()) {
+ Fl_RGB_Image *image2 = (Fl_RGB_Image*)image->copy();
+ image2->normalize();
+ image = image2;
+ }
// OS X >= 10.6 can create a NSImage from a CGImage, but we need to
// support older versions, hence this pesky handling.
@@ -4220,6 +4225,7 @@ int Fl_Cocoa_Window_Driver::set_cursor(const Fl_RGB_Image *image, int hotx, int
[bitmap release];
[nsimage release];
+ if (image->as_svg_image()) delete image;
return 1;
}