/[xmltv_parser]/trunk/libxmltv/Core/XMLTVRuntimeInstance.cs
ViewVC logotype

Diff of /trunk/libxmltv/Core/XMLTVRuntimeInstance.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/libxmltv/Core/XMLTVRuntimeInstance.cs	2013/03/10 14:28:57	110
+++ trunk/libxmltv/Core/XMLTVRuntimeInstance.cs	2013/03/10 15:37:16	111
@@ -341,6 +341,7 @@
                             var ctors = type.GetConstructors(flags);
                             bool has_default_ctor = false;
                             foreach (var ctor in ctors) { if (ctor.GetParameters().Count() == 0) { has_default_ctor = true; } }
+                            ctors = null;
                             if (!has_default_ctor) { continue; }
                             raw_instance = Activator.CreateInstance(type, flags, null, new object[0], culture);
                             if (raw_instance != null)
@@ -349,13 +350,23 @@
                                 if (handler_value != null && handler_value.ToString() == root_name)
                                 {
                                     handler_type = type;
+                                    handler_value = null;
+                                    raw_instance = null;
+                                    handler_prop = null;
+                                    iface = null;
                                     break;
                                 }
+                                handler_value = null;
                             }
+                            raw_instance = null;
                         }
+                        handler_prop = null;
                     }
+                    iface = null;
                 }
             }
+            asm = null;
+            types = null;
             if (handler_type == null) 
             {
                 StringBuilder node_builder = new StringBuilder();
@@ -366,15 +377,18 @@
             }
             xmltv_logger.Verbose.Debug.WriteLine("Created handler for root: '{0}'", root_name.ToString());
             raw_instance = Activator.CreateInstance(handler_type, flags, null, new object[] { gInstance }, culture);
+            raw_instance = null;
+            flags = 0;
+            culture = null;            
         }
 
         private bool CreateHandlerForNode(XElement node)
         {
             if (node == null) { throw new NullReferenceException("Node element is null"); }
             if (node.Name == null) { throw new NullReferenceException("Node element's Name is null"); }
-            var node_name = node.Name.ToString();
+            //var node_name = node.Name.ToString();
 
-            xmltv_logger.Verbose.Debug.WriteLine("Creating handler for node: '{0}'", node_name.ToString());
+            xmltv_logger.Verbose.Debug.WriteLine("Creating handler for node: '{0}'", node.Name.ToString());
             object raw_instance = null;
             BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
             CultureInfo culture = CultureInfo.CurrentCulture;
@@ -394,21 +408,32 @@
                             var ctors = type.GetConstructors(flags);
                             bool has_default_ctor = false;
                             foreach (var ctor in ctors) { if (ctor.GetParameters().Count() == 0) { has_default_ctor = true; } }
+                            ctors = null;
                             if (!has_default_ctor) { continue; }
                             raw_instance = Activator.CreateInstance(type, flags, null, new object[0], culture);
                             if (raw_instance != null)
                             {
                                 object handler_value = handler_prop.GetValue(raw_instance, null);
-                                if (handler_value != null && handler_value.ToString() == node_name)
+                                if (handler_value != null && handler_value.ToString() == node.Name.ToString())
                                 {
                                     handler_type = type;
+                                    handler_value = null;
+                                    raw_instance = null;
+                                    handler_prop = null;
+                                    iface = null;
                                     break;
                                 }
+                                handler_value = null;
                             }
+                            raw_instance = null;
                         }
+                        handler_prop = null;
                     }
+                    iface = null;
                 }
             }
+            asm = null;
+            types = null;
             if (handler_type == null)
             {
                 try
@@ -428,9 +453,13 @@
             }
             else
             {
-                xmltv_logger.Verbose.Debug.WriteLine("Created handler for node: '{0}'", node_name.ToString());
+                xmltv_logger.Verbose.Debug.WriteLine("Created handler for node: '{0}'", node.Name.ToString());
                 raw_instance = Activator.CreateInstance(handler_type, flags, null, new object[] { gInstance, node }, culture);                
             }
+            raw_instance = null;
+            flags = 0;
+            culture = null;
+            node = null;
             return true;
         }
         #region UnhandledExtraMetaData
@@ -446,7 +475,9 @@
                 {
                     ExtraMetaData data = new ExtraMetaData(node);
                     instance.ExtraEntries.Add(data);
+                    data = null;
                 }
+                node = null;
             }
         }
         #endregion

 

  ViewVC Help
Powered by ViewVC 1.1.22