Author: rolf
Date: 2007-10-08 13:58:50 -0400 (Mon, 08 Oct 2007)
New Revision: 87115

Modified:
   trunk/olive/class/agclr/Mono/ChangeLog
   trunk/olive/class/agclr/Mono/ManagedXamlLoader.cs
Log:
* Mono/ManagedXamlLoader.cs: Store the plugin and surface pointers as
  static values. Use those values when creating a native loader
  instead of IntPtr.Zero.

Modified: trunk/olive/class/agclr/Mono/ChangeLog
===================================================================
--- trunk/olive/class/agclr/Mono/ChangeLog      2007-10-08 17:55:13 UTC (rev 
87114)
+++ trunk/olive/class/agclr/Mono/ChangeLog      2007-10-08 17:58:50 UTC (rev 
87115)
@@ -1,3 +1,9 @@
+2007-10-08  Rolf Bjarne Kvinge <[EMAIL PROTECTED]> 
+
+       * ManagedXamlLoader.cs: Store the plugin and surface pointers as static
+         values. Use those values when creating a native loader instead of
+         IntPtr.Zero.
+
 2007-10-04  Zoltan Varga  <[EMAIL PROTECTED]>
 
        * ManagedXamlLoader.cs (LoadDepsSynch): New property to control the 
synchronous

Modified: trunk/olive/class/agclr/Mono/ManagedXamlLoader.cs
===================================================================
--- trunk/olive/class/agclr/Mono/ManagedXamlLoader.cs   2007-10-08 17:55:13 UTC 
(rev 87114)
+++ trunk/olive/class/agclr/Mono/ManagedXamlLoader.cs   2007-10-08 17:58:50 UTC 
(rev 87115)
@@ -39,8 +39,11 @@
 namespace Mono.Xaml
 {
        internal class ManagedXamlLoader : XamlLoader   {
+                // Contains any surface/plugins already loaded in the current 
domain
+               internal static IntPtr surface_in_domain;
+               internal static IntPtr plugin_in_domain;
+               IntPtr surface;
                IntPtr plugin;
-//             IntPtr surface;
                IntPtr native_loader;
 //             string filename;
 //             string contents;
@@ -81,12 +84,12 @@
                
                public void CreateNativeLoader (string filename, string 
contents)
                {
-                       native_loader = NativeMethods.xaml_loader_new 
(filename, contents, IntPtr.Zero);
+                       native_loader = NativeMethods.xaml_loader_new 
(filename, contents, surface_in_domain);
                        
                        if (native_loader == IntPtr.Zero)
                                throw new Exception ("Unable to create native 
loader.");
                        
-                       Setup (native_loader, IntPtr.Zero, IntPtr.Zero, 
filename, contents);
+                       Setup (native_loader, plugin_in_domain, 
surface_in_domain, filename, contents);
                }
                
                public void FreeNativeLoader ()
@@ -99,7 +102,7 @@
                {
                        this.native_loader = native_loader;
                        this.plugin = plugin;
-//                     this.surface = surface;
+                       this.surface = surface;
 //                     this.filename = filename;
 //                     this.contents = contents;
 
@@ -116,8 +119,21 @@
                        if (plugin != IntPtr.Zero) {
                                AppDomain.CurrentDomain.SetData 
("PluginInstance", plugin);
                                
System.Windows.Interop.PluginHost.SetPluginHandle (plugin);
+                               if (plugin_in_domain != IntPtr.Zero && 
plugin_in_domain != plugin) {
+                                       Console.Error.WriteLine ("There already 
is a plugin in this AppDomain.");
+                               } else {
+                                       plugin_in_domain = plugin;
+                               }
                        }
                        
+                       if (surface != IntPtr.Zero) {
+                               if (surface_in_domain != IntPtr.Zero && 
surface_in_domain != surface) {
+                                       Console.Error.WriteLine ("There already 
is a surface in this AppDomain.");
+                               } else {
+                                       surface_in_domain = surface;
+                               }
+                       }
+                       
                }
 
                private string get_mapping (string key)

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to