diff --git a/ase/net/Awk.cpp b/ase/net/Awk.cpp index 022dcded..bcac9380 100644 --- a/ase/net/Awk.cpp +++ b/ase/net/Awk.cpp @@ -1,5 +1,5 @@ /* - * $Id: Awk.cpp,v 1.13 2007/08/15 15:25:06 bacon Exp $ + * $Id: Awk.cpp,v 1.14 2007/08/16 15:19:37 bacon Exp $ */ #include "stdafx.h" @@ -11,6 +11,7 @@ #include #include +#include using System::Runtime::InteropServices::GCHandle; @@ -392,8 +393,9 @@ namespace ASE ase_vfprintf (stderr, fmt, arg); } - protected: - msclr::auto_gcroot wrapper; + public: + //msclr::auto_gcroot wrapper; + gcroot wrapper; }; namespace Net @@ -414,24 +416,37 @@ namespace ASE Awk::~Awk () { System::Diagnostics::Debug::Print ("Awk::~Awk"); - if (awk != NULL) + /*if (awk != NULL) { awk->close (); ASE::Awk* tmp = awk; awk = NULL; delete tmp; + }*/ + if (awk != NULL) + { + awk->close (); + delete awk; + awk = NULL; } } Awk::!Awk () { System::Diagnostics::Debug::Print ("Awk::!Awk"); + /* if (awk != NULL) { awk->close (); ASE::Awk* tmp = awk; awk = NULL; - delete tmp; // this causes Awk::~Awk to be called because the destrucotr of StubAwk reference to this with auto_gcroot + delete tmp; + }*/ + if (awk != NULL) + { + awk->close (); + delete awk; + awk = NULL; } } @@ -453,6 +468,9 @@ System::Diagnostics::Debug::Print ("Awk::!Awk"); if (awk != NULL) { awk->close (); + + // TODO: .... + ((StubAwk*)awk)->wrapper =nullptr; } } diff --git a/ase/test/net/AwkForm.cs b/ase/test/net/AwkForm.cs index 33d0373d..3dd2a8b6 100644 --- a/ase/test/net/AwkForm.cs +++ b/ase/test/net/AwkForm.cs @@ -19,8 +19,10 @@ namespace asetestnet private void btnRun_Click(object sender, EventArgs e) { //using (Awk awk = new Awk()) + for (int i = 0; i < 10000; i++) { - Awk awk = new Awk(); + Awk awk = new Awk(); + tbxSourceOutput.Text = ""; tbxConsoleOutput.Text = ""; @@ -57,8 +59,9 @@ namespace asetestnet } awk.Close(); + //awk.Dispose(); } - //awk.Dispose(); + } private void btnAddArgument_Click(object sender, EventArgs e)