[Gtk-sharp-list] Fixing for delegate issue (crashes in Mono HEAD with MonoDevelop, F-Spot and others).

Miguel de Icaza miguel@novell.com
Sat, 18 Sep 2004 16:46:22 -0400


--=-p6t81117kSI8fONeyha+
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hey Mike,

   The following patch fixes the issues we had with delegates.  There
are a few things to talk about:

	* Should we change from uint to int for the return values
	  of these things, as they would not be otherwise CLS compliant?

	* Should we add a `Remove' to Idle/Timeout that calls
	  Source.Remove?  Just a convenience function?

Miguel.


--=-p6t81117kSI8fONeyha+
Content-Disposition: attachment; filename=delegate-collection.patch
Content-Transfer-Encoding: base64
Content-Type: text/plain; name=delegate-collection.patch; charset=ISO-8859-1

PyBnbGliL2d0ay1zaGFycC5wdWINCkluZGV4OiBDaGFuZ2VMb2cNCj09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0NClJDUyBm
aWxlOiAvY3ZzL3B1YmxpYy9ndGstc2hhcnAvQ2hhbmdlTG9nLHYNCnJldHJpZXZpbmcgcmV2aXNp
b24gMS45MTINCmRpZmYgLXUgLXUgLXIxLjkxMiBDaGFuZ2VMb2cNCi0tLSBDaGFuZ2VMb2cJMTcg
U2VwIDIwMDQgMjA6MzY6NTcgLTAwMDAJMS45MTINCisrKyBDaGFuZ2VMb2cJMTggU2VwIDIwMDQg
MTk6MzM6MzkgLTAwMDANCkBAIC0xLDMgKzEsMjIgQEANCisyMDA0LTA5LTE4ICBNaWd1ZWwgZGUg
SWNhemEgIDxtaWd1ZWxAeGltaWFuLmNvbT4NCisNCisJKiBnbGliL1NvdXJjZS5jczogQWRkIG5l
dyBiYXNlIGNsYXNzIHRvIGhvbGQgdGhlIG1ldGhvZCB0byBiZQ0KKwljYWxsZWQsIGFuZCB0aGUg
cHJveHkgaGFuZGxlciB3ZSB1c2UgdG8ga2VlcCByZWZlcmVuY2VzIHRvIHRoZW0NCisJYW5kIGF2
b2lkIGEg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