Mercurial > dwindows
comparison win/dw.c @ 1143:b1b23de965d7
Fixed using a pointer after being free()ed on Windows and Mac.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 10 Sep 2011 18:34:25 +0000 |
parents | 1c63bf62e0b0 |
children | 091ed7c20b3f |
comparison
equal
deleted
inserted
replaced
1142:88cc189b5e56 | 1143:b1b23de965d7 |
---|---|
10048 */ | 10048 */ |
10049 int API dw_print_run(HPRINT print, unsigned long flags) | 10049 int API dw_print_run(HPRINT print, unsigned long flags) |
10050 { | 10050 { |
10051 DWPrint *p = print; | 10051 DWPrint *p = print; |
10052 HPIXMAP pixmap; | 10052 HPIXMAP pixmap; |
10053 int x; | 10053 int x, result = DW_ERROR_UNKNOWN; |
10054 | 10054 |
10055 if(!p) | 10055 if(!p) |
10056 return DW_ERROR_UNKNOWN; | 10056 return result; |
10057 | 10057 |
10058 if (!(pixmap = calloc(1,sizeof(struct _hpixmap)))) | 10058 if (!(pixmap = calloc(1,sizeof(struct _hpixmap)))) |
10059 return DW_ERROR_UNKNOWN; | 10059 return result; |
10060 | 10060 |
10061 pixmap->width = GetDeviceCaps(p->pd.hDC, PHYSICALWIDTH); | 10061 pixmap->width = GetDeviceCaps(p->pd.hDC, PHYSICALWIDTH); |
10062 pixmap->height = GetDeviceCaps(p->pd.hDC, PHYSICALHEIGHT); | 10062 pixmap->height = GetDeviceCaps(p->pd.hDC, PHYSICALHEIGHT); |
10063 | 10063 |
10064 /*pixmap->handle = handle;*/ | 10064 /*pixmap->handle = handle;*/ |
10077 StartPage(p->pd.hDC); | 10077 StartPage(p->pd.hDC); |
10078 p->drawfunc(print, pixmap, x, p->drawdata); | 10078 p->drawfunc(print, pixmap, x, p->drawdata); |
10079 EndPage(p->pd.hDC); | 10079 EndPage(p->pd.hDC); |
10080 } | 10080 } |
10081 EndDoc(p->pd.hDC); | 10081 EndDoc(p->pd.hDC); |
10082 if(p->drawfunc) | |
10083 result = DW_ERROR_NONE; | |
10082 /* Free memory */ | 10084 /* Free memory */ |
10083 dw_pixmap_destroy(pixmap); | 10085 dw_pixmap_destroy(pixmap); |
10084 free(p); | 10086 free(p); |
10085 return p->drawfunc ? DW_ERROR_NONE : DW_ERROR_UNKNOWN; | 10087 return result; |
10086 } | 10088 } |
10087 | 10089 |
10088 /* | 10090 /* |
10089 * Cancels the print job, typically called from a draw page callback. | 10091 * Cancels the print job, typically called from a draw page callback. |
10090 * Parameters: | 10092 * Parameters: |