Author: rolf
Date: 2007-10-10 03:41:56 -0400 (Wed, 10 Oct 2007)
New Revision: 87241

Modified:
   trunk/olive/class/agclr/Mono/ChangeLog
   trunk/olive/class/agclr/Mono/ManagedXamlLoader.cs
Log:
* Mono/ManagedXamlLoader.cs: Move the static surface and plugin fields
  to XamlLoader.

Modified: trunk/olive/class/agclr/Mono/ChangeLog
===================================================================
--- trunk/olive/class/agclr/Mono/ChangeLog      2007-10-10 07:41:47 UTC (rev 
87240)
+++ trunk/olive/class/agclr/Mono/ChangeLog      2007-10-10 07:41:56 UTC (rev 
87241)
@@ -1,3 +1,8 @@
+2007-10-10  Rolf Bjarne Kvinge <[EMAIL PROTECTED]> 
+
+       * ManagedXamlLoader.cs: Move the static surface and plugin fields to
+         XamlLoader.
+
 2007-10-08  Rolf Bjarne Kvinge <[EMAIL PROTECTED]> 
 
        * ManagedXamlLoader.cs: Store the plugin and surface pointers as static

Modified: trunk/olive/class/agclr/Mono/ManagedXamlLoader.cs
===================================================================
--- trunk/olive/class/agclr/Mono/ManagedXamlLoader.cs   2007-10-10 07:41:47 UTC 
(rev 87240)
+++ trunk/olive/class/agclr/Mono/ManagedXamlLoader.cs   2007-10-10 07:41:56 UTC 
(rev 87241)
@@ -39,9 +39,9 @@
 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;
+               // We keep an instance copy of the surface and plugin here,
+               // since we're not ensuring that there can be only one of each
+               // in each AppDomain.
                IntPtr surface;
                IntPtr plugin;
                IntPtr native_loader;
@@ -84,12 +84,13 @@
                
                public void CreateNativeLoader (string filename, string 
contents)
                {
-                       native_loader = NativeMethods.xaml_loader_new 
(filename, contents, surface_in_domain);
+                       //Console.WriteLine 
("ManagedXamlLoader::CreateNativeLoader (): SurfaceInDomain: {0}", 
SurfaceInDomain);
+                       native_loader = NativeMethods.xaml_loader_new 
(filename, contents, SurfaceInDomain);
                        
                        if (native_loader == IntPtr.Zero)
                                throw new Exception ("Unable to create native 
loader.");
                        
-                       Setup (native_loader, plugin_in_domain, 
surface_in_domain, filename, contents);
+                       Setup (native_loader, PluginInDomain, SurfaceInDomain, 
filename, contents);
                }
                
                public void FreeNativeLoader ()
@@ -119,21 +120,11 @@
                        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;
-                               }
                        }
+
+                       PluginInDomain = plugin;
+                       SurfaceInDomain = surface;
                        
-                       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