Recovered from cvs revision 2007-08-18 11:26:00

This commit is contained in:
hyung-hwan 2007-08-19 00:42:00 +00:00
parent b09566a637
commit 153b5c7b45
2 changed files with 28 additions and 7 deletions

View File

@ -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" #include "stdafx.h"
@ -11,6 +11,7 @@
#include <math.h> #include <math.h>
#include <msclr/auto_gcroot.h> #include <msclr/auto_gcroot.h>
#include <msclr/gcroot.h>
using System::Runtime::InteropServices::GCHandle; using System::Runtime::InteropServices::GCHandle;
@ -392,8 +393,9 @@ namespace ASE
ase_vfprintf (stderr, fmt, arg); ase_vfprintf (stderr, fmt, arg);
} }
protected: public:
msclr::auto_gcroot<ASE::Net::Awk^> wrapper; //msclr::auto_gcroot<ASE::Net::Awk^> wrapper;
gcroot<ASE::Net::Awk^> wrapper;
}; };
namespace Net namespace Net
@ -414,24 +416,37 @@ namespace ASE
Awk::~Awk () Awk::~Awk ()
{ {
System::Diagnostics::Debug::Print ("Awk::~Awk"); System::Diagnostics::Debug::Print ("Awk::~Awk");
if (awk != NULL) /*if (awk != NULL)
{ {
awk->close (); awk->close ();
ASE::Awk* tmp = awk; ASE::Awk* tmp = awk;
awk = NULL; awk = NULL;
delete tmp; delete tmp;
}*/
if (awk != NULL)
{
awk->close ();
delete awk;
awk = NULL;
} }
} }
Awk::!Awk () Awk::!Awk ()
{ {
System::Diagnostics::Debug::Print ("Awk::!Awk"); System::Diagnostics::Debug::Print ("Awk::!Awk");
/*
if (awk != NULL) if (awk != NULL)
{ {
awk->close (); awk->close ();
ASE::Awk* tmp = awk; ASE::Awk* tmp = awk;
awk = NULL; 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) if (awk != NULL)
{ {
awk->close (); awk->close ();
// TODO: ....
((StubAwk*)awk)->wrapper =nullptr;
} }
} }

View File

@ -19,8 +19,10 @@ namespace asetestnet
private void btnRun_Click(object sender, EventArgs e) private void btnRun_Click(object sender, EventArgs e)
{ {
//using (Awk awk = new Awk()) //using (Awk awk = new Awk())
for (int i = 0; i < 10000; i++)
{ {
Awk awk = new Awk(); Awk awk = new Awk();
tbxSourceOutput.Text = ""; tbxSourceOutput.Text = "";
tbxConsoleOutput.Text = ""; tbxConsoleOutput.Text = "";
@ -57,10 +59,11 @@ namespace asetestnet
} }
awk.Close(); awk.Close();
}
//awk.Dispose(); //awk.Dispose();
} }
}
private void btnAddArgument_Click(object sender, EventArgs e) private void btnAddArgument_Click(object sender, EventArgs e)
{ {
if (tbxArgument.Text.Length > 0) if (tbxArgument.Text.Length > 0)