[Sc-devel] [approve] proper cleanup in MLID (was Re: fixed: object leak in NotificationCenter)

James Harkins jamshark70 at gmail.com
Sat Nov 10 18:29:38 PST 2007


Here's my suggestion... again, not necessarily for 3.1.1.

	prRemoveAtPathRecursive { |path, i = 0, item|
		var	name = path[i], result;
		item[name].isNil.if({ ^nil });
		(i < (path.size-1)).if({
			result = this.prRemoveAtPathRecursive(path, i+1, item[name]);
			(item[name].isEmpty).if({ item.removeAt(name) });
			^result
		}, {
			^item.removeAt(name)
		});
	}

	removeAtPath { arg path;
		^this.prRemoveAtPathRecursive(path, 0, dictionary)
	}

hjh


On Nov 10, 2007, at 5:46 PM, James Harkins wrote:

> Actually that's kind of a hack, though, because  
> MultiLevelIdentityDictionary can leave a lot of cruft around  
> depending on how you remove objects from it.
>
> Should be pretty easy to fix in removeAtPath, but it can wait for 3.2.


: H. James Harkins
: jamshark70 at dewdrop-world.net
: http://www.dewdrop-world.net
.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:

"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal."  -- Whitman

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.create.ucsb.edu/pipermail/sc-devel/attachments/20071110/6676ef79/attachment.htm


More information about the Sc-devel mailing list