changeset 1948:bbb1fb54f321

Mac: Need to retain the cached render bitmap and recreate it on resize on 10.14.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 06 Jul 2019 18:44:25 +0000
parents 3aef9be654ce
children c71e5da5b801
files mac/dw.m
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mac/dw.m	Sat Jul 06 16:17:04 2019 +0000
+++ b/mac/dw.m	Sat Jul 06 18:44:25 2019 +0000
@@ -862,12 +862,24 @@
 -(void)setUserdata:(void *)input { userdata = input; }
 -(void)setFont:(NSFont *)input { [font release]; font = input; [font retain]; }
 -(NSFont *)font { return font; }
--(void)setSize:(NSSize)input { size = input; }
+-(void)setSize:(NSSize)input {
+    size = input;
+    if(cachedDrawingRep)
+    {
+        NSBitmapImageRep *oldrep = cachedDrawingRep;
+        cachedDrawingRep = [self bitmapImageRepForCachingDisplayInRect:self.bounds];
+        [cachedDrawingRep retain];
+        [oldrep release];
+    }
+}
 -(NSSize)size { return size; }
 #ifdef BUILDING_FOR_MOJAVE
 -(NSBitmapImageRep *)cachedDrawingRep {
     if(!cachedDrawingRep)
+    {
         cachedDrawingRep = [self bitmapImageRepForCachingDisplayInRect:self.bounds];
+        [cachedDrawingRep retain];
+    }
     return cachedDrawingRep;
 }
 #endif