summaryrefslogtreecommitdiff
path: root/src/macfont.m
diff options
context:
space:
mode:
authorJan Djärv <jan.h.d@swipnet.se>2013-11-04 18:57:17 +0100
committerJan Djärv <jan.h.d@swipnet.se>2013-11-04 18:57:17 +0100
commitc8b09927b5ae87b19e8880614ac2b23e3c0df6e6 (patch)
treeb40122b3bc82cd4436fa5bc9c630897df6c86de3 /src/macfont.m
parentbe80645a9ac60598a4a7809e2be07243846b746c (diff)
downloademacs-c8b09927b5ae87b19e8880614ac2b23e3c0df6e6.tar.gz
Fix memory leaks in NS version.
* src/macfont.m (CG_SET_FILL_COLOR_WITH_GC_FOREGROUND) (CG_SET_FILL_COLOR_WITH_GC_BACKGROUND) (CG_SET_STROKE_COLOR_WITH_GC_FOREGROUND): Fix memory leak. * src/nsfns.m (Fx_create_frame): Fix memory leak. * src/nsterm.h (EmacsApp): Add shouldKeepRunning and isFirst for OSX >= 10.9. * src/nsterm.m (init, run, stop:): New methods in EmacsApp for OSX >= 10.9 to prevent memory leak of GCD dispatch source.
Diffstat (limited to 'src/macfont.m')
-rw-r--r--src/macfont.m29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/macfont.m b/src/macfont.m
index 150aca07651..4b8be551786 100644
--- a/src/macfont.m
+++ b/src/macfont.m
@@ -624,19 +624,26 @@ get_cgcolor(unsigned long idx, struct frame *f)
}
#define CG_SET_FILL_COLOR_WITH_GC_FOREGROUND(context, s) \
- CGContextSetFillColorWithColor (context, \
- get_cgcolor (NS_FACE_FOREGROUND (s->face), \
- s->f))
-
+ do { \
+ CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (s->face), \
+ s->f); \
+ CGContextSetFillColorWithColor (context, refcol_) ; \
+ CGColorRelease (refcol_); \
+ } while (0)
#define CG_SET_FILL_COLOR_WITH_GC_BACKGROUND(context, s) \
- CGContextSetFillColorWithColor (context, \
- get_cgcolor (NS_FACE_BACKGROUND (s->face), \
- s->f))
-
+ do { \
+ CGColorRef refcol_ = get_cgcolor (NS_FACE_BACKGROUND (s->face),\
+ s->f); \
+ CGContextSetFillColorWithColor (context, refcol_); \
+ CGColorRelease (refcol_); \
+ } while (0)
#define CG_SET_STROKE_COLOR_WITH_GC_FOREGROUND(context, s) \
- CGContextSetStrokeColorWithColor (context, \
- get_cgcolor (NS_FACE_FOREGROUND (s->face),\
- s->f))
+ do { \
+ CGColorRef refcol_ = get_cgcolor (NS_FACE_FOREGROUND (s->face),\
+ s->f); \
+ CGContextSetStrokeColorWithColor (context, refcol_); \
+ CGColorRelease (refcol_); \
+ } while (0)
/* Mac font driver. */