Skip to content

Commit

Permalink
Add Dispose calls when tokenstream is not reused
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirwin committed Dec 19, 2024
1 parent c10968e commit 90ad94d
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,10 @@ private static void CheckAnalysisConsistency(Random random, Analyzer a, bool use
// LUCENENET: We are doing this in the finally block to ensure it happens
// when there are exceptions thrown (such as when the assert fails).
ts.Close();

// ... and we dispose of it because it's the last use of the token stream
// before being reassigned below
ts.Dispose();
}

// verify reusing is "reproducable" and also get the normal tokenstream sanity checks
Expand Down Expand Up @@ -1043,6 +1047,7 @@ private static void CheckAnalysisConsistency(Random random, Analyzer a, bool use
finally
{
ts.Close();
ts.Dispose();
}
}
else if (evilness == 7)
Expand Down Expand Up @@ -1075,6 +1080,7 @@ private static void CheckAnalysisConsistency(Random random, Analyzer a, bool use
finally
{
ts.Close();
ts.Dispose();
}
}
}
Expand Down Expand Up @@ -1179,6 +1185,7 @@ private static void CheckAnalysisConsistency(Random random, Analyzer a, bool use
finally
{
ts.Close();
ts.Dispose();
}

if (field != null)
Expand Down

0 comments on commit 90ad94d

Please sign in to comment.