changeset 447:5a0779561d0f

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.
author mhessling@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 03 Jun 2003 09:13:35 +0000
parents ab549e2f34b9
children e81af9e60697
files gtk/dw.c os2/dw.c win/dw.c
diffstat 3 files changed, 61 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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")))
--- 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);
--- 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)
 	{