private void DestroyPTSContexts()
        {
            int i = 0;

            while (i < this._contextPool.Count)
            {
                PtsContext ptsContext = this._contextPool[i].Owner.Target as PtsContext;
                if (ptsContext != null)
                {
                    Invariant.Assert(this._contextPool[i].PtsHost.Context == ptsContext.Context, "PTS Context mismatch.");
                    this._contextPool[i].Owner = new WeakReference(null);
                    this._contextPool[i].InUse = false;
                    Invariant.Assert(!ptsContext.Disposed, "PtsContext has been already disposed.");
                    ptsContext.Dispose();
                }
                if (!this._contextPool[i].InUse)
                {
                    Invariant.Assert(this._contextPool[i].PtsHost.Context != IntPtr.Zero, "PTS Context handle is not valid.");
                    PTS.IgnoreError(PTS.DestroyDocContext(this._contextPool[i].PtsHost.Context));
                    Invariant.Assert(this._contextPool[i].InstalledObjects != IntPtr.Zero, "Installed Objects handle is not valid.");
                    PTS.IgnoreError(PTS.DestroyInstalledObjectsInfo(this._contextPool[i].InstalledObjects));
                    if (this._contextPool[i].TextPenaltyModule != null)
                    {
                        this._contextPool[i].TextPenaltyModule.Dispose();
                    }
                    this._contextPool.RemoveAt(i);
                }
                else
                {
                    i++;
                }
            }
        }