delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/03/04/10:33:14

From: awandelt AT rs1 DOT thch DOT uni-bonn DOT de (Andreas Wandelt)
Subject: bug in SUIT?
To: djgpp AT sun DOT soe DOT clarkson DOT edu, suit-users AT uvacs DOT cs DOT virginia DOT edu
Date: Sun, 28 Feb 1993 14:56:27 +22306256 (NFT)
Cc: awandelt AT rs1 DOT thch DOT uni-bonn DOT de (Andreas Wandelt)

I am working with the SUIT library and the djgpp compiler on a PC and stumbled
over a very nasty bug yesterday. IMHO, it must be a bug either in the
SUIT or SRGP libraries or in djgpp/libgrx.

To put it simply: At least on my system and on any other PC I tested this
on *every* program seems to crash if it creates and destroys too many
widgets. How many are necessary, seems to depend on the application, but
not on the system (RAM, graphics, whatever...).

Here is a description of everything i found out, together with a sample
program:

The sample program creates and destroys a label widget 1000 times. The result:
The 'done' button cannot be pressed (you can move the mouse, but there
is no action), and if you try to invoke SUITs property editor (SUIT-e) after
the program prints its 'ready' message, the program crashes (segmentation
violation).  The same happens if you
at first create the 1000 labels, and then destroy them (in the order of
creation or in reverse order) . Everything works fine if you
just create and don't destroy the labels (it just takes quite a while ;-).

Well, but why should someone create and destroy 1000 widgets? 
The same error occurs if I run the 'filebox1' program from the SUIT
examples and invoke and cancel the filebox about 50 times. In the application
i am working on the error occurred after invoking and destroying a popup
menu (vertical menu with 3-10 items) 5-10 times. Sometimes, the crash
announces itself in such a way that suddenly buttons get pressed, borders
disappear, and other properties of arbitrary widgets seem to change at random.

If I decrease the number of repetitions in the sample program from 1000 to,
say, 850, then the property editor can be invoked, but without borders. And as
soon as I try to *do* anything, the crash happens.

This behaviour is not dependent on the compiler flags -g, -O, or -O2. Also,
it seems to be independent on the PC the program runs on.
I had no chance, though, to test the sample program on a XWindows system.

It seems to me that something in the SUIT_destroyObject function overwrites
program code and other widget's properties. Maybe someone frees more memory
than he allocated?

Has anyone ever had similar problems? Is the error reproductible under
SUIT/XWindows? Or at least on other PC/djgpp systems? And, above all,
does anybody know what to do about it??

Any help would be much (MUCH!) appreciated.

Andreas Wandelt
Institute for Physical Chemistry
University of Bonn, Germany


P.S.: here comes the sample program:

---------------------------------------------------------------------

#include <std.h>
#include <suit.h>

void Callback(SUIT_object obj) {

	int i;

	for(i=0;i<1000;i++) {
		SUIT_destroyObject(SUIT_createLabel("test"));
	}
	printf("ready\n");
}

int main(int argc, char **argv) {

	SUIT_init(argv[0]);
	SUIT_object but=SUIT_createButton("button",Callback);
	SUIT_createDoneButton (NULL);
	SUIT_beginStandardApplication();
	return(0);
}




- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019