tmore places where display can be nil - plan9port - [fork] Plan 9 from user space
git clone git://src.adamsgaard.dk/plan9port
Log
Files
Refs
README
LICENSE
---
commit ca63c078d9b658b2f8d99c8e3e1a2389d0e7f6d7
parent 2ec48bbca32b5483b746cac1f2e6121171e33544
Author: rsc 
Date:   Wed, 13 Jul 2005 03:56:21 +0000

more places where display can be nil

Diffstat:
  M src/libdraw/alloc.c                 |       2 +-
  M src/libdraw/buildfont.c             |       2 +-
  M src/libdraw/font.c                  |       2 +-

3 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/libdraw/alloc.c b/src/libdraw/alloc.c
t@@ -196,7 +196,7 @@ _freeimage1(Image *i)
         Display *d;
         Image *w;
 
-        if(i == 0)
+        if(i == 0 || i->display == 0)
                 return 0;
         /* make sure no refresh events occur on this if we block in the write */
         d = i->display;
diff --git a/src/libdraw/buildfont.c b/src/libdraw/buildfont.c
t@@ -129,7 +129,7 @@ freefont(Font *f)
         }
         for(i=0; insubf; i++){
                 s = f->subf[i].f;
-                if(s && s!=display->defaultsubfont)
+                if(s && (!display || s!=display->defaultsubfont))
                         freesubfont(s);
         }
         freeimage(f->cacheimage);
diff --git a/src/libdraw/font.c b/src/libdraw/font.c
t@@ -132,7 +132,7 @@ agefont(Font *f)
                         if(s->age){
                                 if(s->agecf->name != nil){
                                         /* clean up */
-                                        if(s->f != display->defaultsubfont)
+                                        if(display==nil || s->f != display->defaultsubfont)
                                                 freesubfont(s->f);
                                         s->cf = nil;
                                         s->f = nil;