Mercurial > dwindows
comparison os2/dw.c @ 1827:04c74cd0fb35
Test fix for crash changing bitmap on bitmap buttons on OS/2.
Didn't notice that there was already code to free the pixmaps...
So changing the bitmap on buttons that already had pixmaps crashed.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 29 Oct 2012 17:42:44 +0000 |
parents | 213420512084 |
children | e0df1916b054 |
comparison
equal
deleted
inserted
replaced
1826:10c59bb2c47f | 1827:04c74cd0fb35 |
---|---|
429 HDC hdc = (HDC)dw_window_get_data(handle, "_dw_hdc"); | 429 HDC hdc = (HDC)dw_window_get_data(handle, "_dw_hdc"); |
430 HPIXMAP pixmap = (HPIXMAP)dw_window_get_data(handle, "_dw_hpixmap"); | 430 HPIXMAP pixmap = (HPIXMAP)dw_window_get_data(handle, "_dw_hpixmap"); |
431 HPIXMAP disable = (HPIXMAP)dw_window_get_data(handle, "_dw_hpixmap_disabled"); | 431 HPIXMAP disable = (HPIXMAP)dw_window_get_data(handle, "_dw_hpixmap_disabled"); |
432 HPOINTER icon = (HPOINTER)dw_window_get_data(handle, "_dw_button_icon"); | 432 HPOINTER icon = (HPOINTER)dw_window_get_data(handle, "_dw_button_icon"); |
433 | 433 |
434 /* For safety purposes, reset all the window data */ | |
435 dw_window_set_data(handle, "_dw_bitmap", NULL); | |
436 dw_window_set_data(handle, "_dw_hps", NULL); | |
437 dw_window_set_data(handle, "_dw_hdc", NULL); | |
438 dw_window_set_data(handle, "_dw_hpixmap", NULL); | |
439 dw_window_set_data(handle, "_dw_hpixmap_disabled", NULL); | |
440 dw_window_set_data(handle, "_dw_button_icon", NULL); | |
441 | |
434 if(icon) | 442 if(icon) |
435 WinDestroyPointer(icon); | 443 WinDestroyPointer(icon); |
436 | 444 |
437 if(pixmap) | 445 if(pixmap) |
438 dw_pixmap_destroy(pixmap); | 446 dw_pixmap_destroy(pixmap); |
7293 { | 7301 { |
7294 dw_window_set_data(handle, "_dw_button_icon", DW_POINTER(icon)); | 7302 dw_window_set_data(handle, "_dw_button_icon", DW_POINTER(icon)); |
7295 } | 7303 } |
7296 else | 7304 else |
7297 { | 7305 { |
7298 HPIXMAP pixmap = (HPIXMAP)dw_window_get_data(handle, "_dw_hpixmap"); | 7306 HPIXMAP disabled, pixmap = calloc(1,sizeof(struct _hpixmap)); |
7299 HPIXMAP disabled = (HPIXMAP)dw_window_get_data(handle, "_dw_hpixmap_disabled"); | 7307 |
7300 | |
7301 if(pixmap) | |
7302 dw_pixmap_destroy(pixmap); | |
7303 if(disabled) | |
7304 dw_pixmap_destroy(disabled); | |
7305 | |
7306 pixmap = calloc(1,sizeof(struct _hpixmap)); | |
7307 pixmap->hbm = hbm; | 7308 pixmap->hbm = hbm; |
7308 pixmap->hdc = hdc; | 7309 pixmap->hdc = hdc; |
7309 pixmap->hps = hps; | 7310 pixmap->hps = hps; |
7310 pixmap->width = width; | 7311 pixmap->width = width; |
7311 pixmap->height = height; | 7312 pixmap->height = height; |