lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r1059416 - /lucene/lucene.net/tags/Lucene.Net_2_9_2/src/Lucene.Net/Index/SegmentReader.cs
Date Sat, 15 Jan 2011 21:42:13 GMT
Author: digy
Date: Sat Jan 15 21:42:13 2011
New Revision: 1059416

URL: http://svn.apache.org/viewvc?rev=1059416&view=rev
Log:
[LUCENENET-375] (2.9.2) Getting assert in SegmentReader.cs (Lucene.net_2_9_2)

Modified:
    lucene/lucene.net/tags/Lucene.Net_2_9_2/src/Lucene.Net/Index/SegmentReader.cs

Modified: lucene/lucene.net/tags/Lucene.Net_2_9_2/src/Lucene.Net/Index/SegmentReader.cs
URL: http://svn.apache.org/viewvc/lucene/lucene.net/tags/Lucene.Net_2_9_2/src/Lucene.Net/Index/SegmentReader.cs?rev=1059416&r1=1059415&r2=1059416&view=diff
==============================================================================
--- lucene/lucene.net/tags/Lucene.Net_2_9_2/src/Lucene.Net/Index/SegmentReader.cs (original)
+++ lucene/lucene.net/tags/Lucene.Net_2_9_2/src/Lucene.Net/Index/SegmentReader.cs Sat Jan
15 21:42:13 2011
@@ -671,43 +671,46 @@ namespace Lucene.Net.Index
 			// IndexInput & bytes with the original one
 			public System.Object Clone()
 			{
-				System.Diagnostics.Debug.Assert(refCount > 0 &&(origNorm == null || origNorm.refCount
> 0));
-				
-				Norm clone;
-				try
-				{
-					clone = (Norm) base.MemberwiseClone();
-				}
-				catch (System.Exception cnse)
-				{
-					// Cannot happen
-					throw new System.SystemException("unexpected CloneNotSupportedException", cnse);
-				}
-				clone.refCount = 1;
-				
-				if (bytes != null)
-				{
-					System.Diagnostics.Debug.Assert(bytesRef != null);
-					System.Diagnostics.Debug.Assert(origNorm == null);
-					
-					// Clone holds a reference to my bytes:
-					clone.bytesRef.IncRef();
-				}
-				else
-				{
-					System.Diagnostics.Debug.Assert(bytesRef == null);
-					if (origNorm == null)
-					{
-						// I become the origNorm for the clone:
-						clone.origNorm = this;
-					}
-					clone.origNorm.IncRef();
-				}
-				
-				// Only the origNorm will actually readBytes from in:
-				clone.in_Renamed = null;
-				
-				return clone;
+                lock (this) //LUCENENET-375
+                {
+                    System.Diagnostics.Debug.Assert(refCount > 0 && (origNorm
== null || origNorm.refCount > 0));
+
+                    Norm clone;
+                    try
+                    {
+                        clone = (Norm)base.MemberwiseClone();
+                    }
+                    catch (System.Exception cnse)
+                    {
+                        // Cannot happen
+                        throw new System.SystemException("unexpected CloneNotSupportedException",
cnse);
+                    }
+                    clone.refCount = 1;
+
+                    if (bytes != null)
+                    {
+                        System.Diagnostics.Debug.Assert(bytesRef != null);
+                        System.Diagnostics.Debug.Assert(origNorm == null);
+
+                        // Clone holds a reference to my bytes:
+                        clone.bytesRef.IncRef();
+                    }
+                    else
+                    {
+                        System.Diagnostics.Debug.Assert(bytesRef == null);
+                        if (origNorm == null)
+                        {
+                            // I become the origNorm for the clone:
+                            clone.origNorm = this;
+                        }
+                        clone.origNorm.IncRef();
+                    }
+
+                    // Only the origNorm will actually readBytes from in:
+                    clone.in_Renamed = null;
+
+                    return clone;
+                }
 			}
 			
 			// Flush all pending changes to the next generation



Mime
View raw message