supercoolxyz / luainterface

Automatically exported from code.google.com/p/luainterface
0 stars 0 forks source link

some gctm methods in translator object before Lua Close #45

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. In multithread environment, CLR gc will collect some gctm methods in 
translator object before Lua Close.

Please provide any additional information below.

        #region IDisposable Members

        public virtual void Dispose()
        {
            if (translator != null)
            {
                translator.pendingEvents.Dispose();
                translator = null;
            }

            this.Close();
            System.GC.Collect();
            System.GC.WaitForPendingFinalizers();
        }

        #endregion

modify as below:

        #region IDisposable Members

        public virtual void Dispose()
        {
            if (translator != null)
            {
                translator.pendingEvents.Dispose();
            }

            this.Close();
            translator = null;
            System.GC.Collect();
            System.GC.WaitForPendingFinalizers();
        }

        #endregion

can correct this problem.

Original issue reported on code.google.com by caoshi...@gmail.com on 5 Jan 2012 at 8:02