🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.windows.interviews
1 messages
1 total messages Started by Jason Scheck Wed, 06 Jan 1993 21:49
Resource life problem
#1625
Author: Jason Scheck
Date: Wed, 06 Jan 1993 21:49
37 lines
1998 bytes
The idemo program contains the following line (it may have changed
since I grabbed the version I am using a few InterViews versions ago):

    main_ = new ApplicationWindow(
	new Background(
	    layout.vcenter(
		layout.vbox(
		    layout.vcenter(menubar(), 1.0),
		    body_
		)
	    ),
	    kit.background()
	)
    );

I am running this program on a 68k machine, using gcc 2.3.3 as the
compiler, with optimization turned on.  The compiler decided to call
kit.background() before calling the first part of the call to
Background::Background().  kit.background() returns a color with a
refcount of one.  However, the call to menubar() causes the resources
to be re-read, and the previously-read colors are unreferenced, which
causes the background to go to a reference count of zero, and it is
deleted.  However, we already have a pointer to the background that is
subsequently passed to the Background constructor (which by this time
point to something else entirely).  This problem only seems to
manifest itself with the Openlook and Motif kits (not the SMFKit), for
some reason.  The sparc version of gcc evaluates the arguments in the
opposite order, so the problem is not seen.

There are a number of ways of working around the problem in this
instance.  However, I can see the problem popping up in a number of
similar circumstances.  Any ideas about a general solution?

------------------------------------
E. Jason Scheck
jasons@tv.TV.TEK.COM
------------------------------------
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads