# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1351532564 0 # Node ID 04c74cd0fb354ef5361a02ec1cd2f4002a1a2ff3 # Parent 10c59bb2c47f7338c363549ee31d03e557048bd8 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. diff -r 10c59bb2c47f -r 04c74cd0fb35 os2/dw.c --- a/os2/dw.c Sun Oct 28 02:59:56 2012 +0000 +++ b/os2/dw.c Mon Oct 29 17:42:44 2012 +0000 @@ -431,6 +431,14 @@ HPIXMAP disable = (HPIXMAP)dw_window_get_data(handle, "_dw_hpixmap_disabled"); HPOINTER icon = (HPOINTER)dw_window_get_data(handle, "_dw_button_icon"); + /* For safety purposes, reset all the window data */ + dw_window_set_data(handle, "_dw_bitmap", NULL); + dw_window_set_data(handle, "_dw_hps", NULL); + dw_window_set_data(handle, "_dw_hdc", NULL); + dw_window_set_data(handle, "_dw_hpixmap", NULL); + dw_window_set_data(handle, "_dw_hpixmap_disabled", NULL); + dw_window_set_data(handle, "_dw_button_icon", NULL); + if(icon) WinDestroyPointer(icon); @@ -7295,15 +7303,8 @@ } else { - HPIXMAP pixmap = (HPIXMAP)dw_window_get_data(handle, "_dw_hpixmap"); - HPIXMAP disabled = (HPIXMAP)dw_window_get_data(handle, "_dw_hpixmap_disabled"); - - if(pixmap) - dw_pixmap_destroy(pixmap); - if(disabled) - dw_pixmap_destroy(disabled); - - pixmap = calloc(1,sizeof(struct _hpixmap)); + HPIXMAP disabled, pixmap = calloc(1,sizeof(struct _hpixmap)); + pixmap->hbm = hbm; pixmap->hdc = hdc; pixmap->hps = hps;