[Mono-list] Unload AppDomain containing GTK Window

Rodrigo Kumpera kumpera at gmail.com
Mon Jul 2 17:08:18 UTC 2012


GTK# does not work with multiple appdomains. You must do everything from
the root domain.

On Mon, Jul 2, 2012 at 10:44 AM, Adrian Stern
<adrian.stern at screenfood.com>wrote:

>  Hello
>
>
>
> Since the Flashplugin is not very stable and on top of that leaks memory
> in long term use we try to run this critical part in a seperate AppDomain.
>
> While creating and interacting with this window works fine, unloading the
> updomain causes the whole app to crash.
>
>
>
> Since the unload works when i remove the Gtk.Window from the marshal
> object i can confirm this problem to be Gtk related (GTK Sharp)
>
> Run on Ubuntu 11.4 and 12.4. This Bug seems to be known since 2004.
>
>
>
> Running this sample every x seconds (loop) should just open a new window
> every x seconds while closing and destroying the other.
>
>
>
> Any idey how i could accomplish this?
>
>
>
> What i do:
>
> #################################################
>
> ##### Class to run in other AppDomain and ist proxy class
>
> #################################################
>
>
>
> public class Fanta
>
> {
>
>   string s;
>
>
>
>  // commenting this line out will cause the example to work!
>
>   Gtk.Window w = new Gtk.Window(Gtk.WindowType.Toplevel);
>
>
>
>   public Fanta(){ s = "blubb"; }
>
>
>
>   public void echoS(){ Console.WriteLine( s );}
>
> }
>
>
>
> public class FantaProxy : MarshalByRefObject
>
> {
>
>   Fanta f = new Fanta();
>
>
>
>   public void echoS(){
>
>     f.GetType().InvokeMember("echoS", BindingFlags.InvokeMethod, null, f,
> null );
>
>   }
>
> }
>
>
>
> #################################################
>
> ##### Code which causes the app to exit
>
> #################################################
>
>
>
> // d is a gobal AppDomain
>
> // fp is FantaProxy  Type (also global)
>
>
>
> d = AppDomain.CreateDomain( "FantaD");
>
> string currentAssemblyPath = Assembly.GetExecutingAssembly().Location;
>
> fp = d.CreateInstanceFromAndUnwrap( currentAssemblyPath,
> "AppDomainTest.FantaProxy" ) as FantaProxy;
>
> fp.echoS();
>
> AppDomain.Unload( d );
>  Diese E-Mail und ihre Anhänge enthalten vertrauliche und/oder rechtlich
> geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder
> diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den
> Absender und vernichten Sie diese Mail inklusive Anhänge. Das unerlaubte
> Kopieren sowie die unbefugte Weitergabe der Inhalte dieser Mail ist nicht
> gestattet.
> This e-mail and any attachments may contain confidential and/or privileged
> information. If you are not the intended recipient (or have received this
> e-mail in error) please notify the sender immediately and destroy this
> e-mail including the attachments. Any unauthorized copying, disclosure or
> distribution of the material in this e-mail is strictly forbidden.
>
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20120702/1797149d/attachment-0001.html>


More information about the Mono-list mailing list