mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 23:22:51 +08:00
Properly implement IDisposable.
This commit is contained in:
@@ -984,7 +984,7 @@ namespace openalprnet {
|
|||||||
bool m_cancel;
|
bool m_cancel;
|
||||||
};
|
};
|
||||||
|
|
||||||
public ref class AlprNet sealed
|
public ref class AlprNet sealed : IDisposable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Allocate the native object on the C++ Heap via a constructor
|
// Allocate the native object on the C++ Heap via a constructor
|
||||||
@@ -993,11 +993,16 @@ namespace openalprnet {
|
|||||||
this->m_config = gcnew AlprConfigNet(this->m_Impl->getConfig());
|
this->m_config = gcnew AlprConfigNet(this->m_Impl->getConfig());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deallocate the native object on a destructor
|
~AlprNet() {
|
||||||
~AlprNet(){
|
if(this->m_Disposed)
|
||||||
delete m_Impl;
|
{
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->!AlprNet();
|
||||||
|
this->m_Disposed = true;
|
||||||
|
}
|
||||||
|
|
||||||
property AlprConfigNet^ Configuration {
|
property AlprConfigNet^ Configuration {
|
||||||
AlprConfigNet^ get()
|
AlprConfigNet^ get()
|
||||||
{
|
{
|
||||||
@@ -1128,5 +1133,6 @@ namespace openalprnet {
|
|||||||
int m_topN;
|
int m_topN;
|
||||||
bool m_detectRegion;
|
bool m_detectRegion;
|
||||||
System::String^ m_defaultRegion;
|
System::String^ m_defaultRegion;
|
||||||
|
bool m_Disposed;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user