# HG changeset patch # User mhessling@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1054631615 0 # Node ID 5a0779561d0f4ba157708e3a74294a092bb4eb8a # Parent ab549e2f34b920e018cddf90469e2b983504091d Add more tests for dw_pac*() functions. Throw up a messagebox if you try and pack an item into itself; at least under GTK this causes an inifinite loop. Under GTK, add functionality to dw_spinbutton_set_limits() to actually do something. diff -r ab549e2f34b9 -r 5a0779561d0f gtk/dw.c --- a/gtk/dw.c Tue Jun 03 09:08:33 2003 +0000 +++ b/gtk/dw.c Tue Jun 03 09:13:35 2003 +0000 @@ -3747,6 +3747,7 @@ curval = dw_spinbutton_query(handle); DW_MUTEX_LOCK; adj = (GtkAdjustment *)gtk_adjustment_new((gfloat)curval, (gfloat)lower, (gfloat)upper, 1.0, 5.0, 0.0); + gtk_spin_button_set_adjustment(GTK_SPIN_BUTTON(handle), adj); DW_MUTEX_UNLOCK; } @@ -6169,6 +6170,16 @@ if(!box) return; + /* + * If you try and pack an item into itself VERY bad things can happen; like at least an + * infinite loop on GTK! Lets be safe! + */ + if(box == item) + { + dw_messagebox("dw_box_pack_end()", DW_MB_OK|DW_MB_ERROR, "Danger! Danger! Will Robinson; box and item are the same!",box,item); + return; + } + DW_MUTEX_LOCK; if((tmp = gtk_object_get_data(GTK_OBJECT(box), "_dw_boxhandle"))) @@ -7348,6 +7359,16 @@ if(!box) return; + /* + * If you try and pack an item into itself VERY bad things can happen; like at least an + * infinite loop on GTK! Lets be safe! + */ + if(box == item) + { + dw_messagebox("dw_box_pack_start()", DW_MB_OK|DW_MB_ERROR, "Danger! Danger! Will Robinson; box and item are the same!",box,item); + return; + } + DW_MUTEX_LOCK; if((tmp = gtk_object_get_data(GTK_OBJECT(box), "_dw_boxhandle"))) diff -r ab549e2f34b9 -r 5a0779561d0f os2/dw.c --- a/os2/dw.c Tue Jun 03 09:08:33 2003 +0000 +++ b/os2/dw.c Tue Jun 03 09:13:35 2003 +0000 @@ -4978,6 +4978,16 @@ { Box *thisbox; + /* + * If you try and pack an item into itself VERY bad things can happen; like at least an + * infinite loop on GTK! Lets be safe! + */ + if(box == item) + { + dw_messagebox("dw_box_pack_end()", DW_MB_OK|DW_MB_ERROR, "Danger! Danger! Will Robinson; box and item are the same!",box,item); + return; + } + if(WinWindowFromID(box, FID_CLIENT)) { box = WinWindowFromID(box, FID_CLIENT); @@ -7624,6 +7634,16 @@ { Box *thisbox; + /* + * If you try and pack an item into itself VERY bad things can happen; like at least an + * infinite loop on GTK! Lets be safe! + */ + if(box == item) + { + dw_messagebox("dw_box_pack_start()", DW_MB_OK|DW_MB_ERROR, "Danger! Danger! Will Robinson; box and item are the same!",box,item); + return; + } + if(WinWindowFromID(box, FID_CLIENT)) { box = WinWindowFromID(box, FID_CLIENT); diff -r ab549e2f34b9 -r 5a0779561d0f win/dw.c --- a/win/dw.c Tue Jun 03 09:08:33 2003 +0000 +++ b/win/dw.c Tue Jun 03 09:13:35 2003 +0000 @@ -4732,6 +4732,16 @@ { Box *thisbox; + /* + * If you try and pack an item into itself VERY bad things can happen; like at least an + * infinite loop on GTK! Lets be safe! + */ + if(box == item) + { + dw_messagebox("dw_box_pack_start()", DW_MB_OK|DW_MB_ERROR, "Danger! Danger! Will Robinson; box and item are the same!",box,item); + return; + } + thisbox = (Box *)GetWindowLongPtr(box, GWLP_USERDATA); if(thisbox) { @@ -7531,6 +7541,16 @@ { Box *thisbox; + /* + * If you try and pack an item into itself VERY bad things can happen; like at least an + * infinite loop on GTK! Lets be safe! + */ + if(box == item) + { + dw_messagebox("dw_box_pack_end()", DW_MB_OK|DW_MB_ERROR, "Danger! Danger! Will Robinson; box and item are the same!",box,item); + return; + } + thisbox = (Box *)GetWindowLongPtr(box, GWLP_USERDATA); if(thisbox) {