Esri / file-geodatabase-api

FileGeodatabaseAPI_1.4 (1.4.0.183) The File Geodatabase C++ API for Windows, MacOS and Linux
Apache License 2.0
149 stars 60 forks source link

Crash on `DeleteGeodatabase` #22

Open rminderhoud opened 5 years ago

rminderhoud commented 5 years ago

Version: filegdb-api-1.5.1-vs2017 (x64) Toolchain: VS2017 (15.9.7) -- Windows SDK 8.1 -- Platform toolset v141 OS: Windows 10 (10.0.17134)

It seems calling DeleteGeodatabase causes a crash on my system. Here is the errorspit out by the debugger:

image

And here is the call stack:

    msvcp140d.dll!00007ffb90aefb86()    Unknown
>   FileGDBAPID.dll!std::_Vector_const_iterator<class std::_Vector_val<struct std::_Simple_types<class FileGDBAPI::Geodatabase *> > >::operator++(void) Unknown
    FileGDBAPID.dll!std::_Vector_iterator<class std::_Vector_val<struct std::_Simple_types<class FileGDBAPI::Geodatabase *> > >::operator++(void)   Unknown
    FileGDBAPID.dll!std::_Vector_iterator<class std::_Vector_val<struct std::_Simple_types<class FileGDBAPI::Geodatabase *> > >::operator++(int)    Unknown
    FileGDBAPID.dll!CatalogRegistry::DeleteGDB(class FileGDBAPI::Geodatabase *,class Catalog *) Unknown
    FileGDBAPID.dll!FileGDBAPI::Geodatabase::DeleteGeodatabase(void)    Unknown
    FileGDBAPID.dll!FileGDBAPI::DeleteGeodatabase(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &) Unknown

Example invocation:

const wchar_t* path = L"C:\\Users\\RALPHM~1\\AppData\\Local\\Temp\\test.gdb"
FileGDBAPI::DeleteGeodatabase(path);

Using a long path does not resolve the issue.

rminderhoud commented 5 years ago

Actually, it appears this only occurs if you try to destroy a gdb right after creation without closing it:

Crashes:

const wchar_t* path = L"C:\\Users\\RALPHM~1\\AppData\\Local\\Temp\\test.gdb";
FileGDBAPI::Geodatabase fgdb;
FILEGDBAPI::CreateGeodatabase(path, fgdb);
FileGDBAPI::DeleteGeodatabase(path);

Works:

const wchar_t* path = L"C:\\Users\\RALPHM~1\\AppData\\Local\\Temp\\test.gdb";
FileGDBAPI::Geodatabase fgdb;
FileGDBAPI::CreateGeodatabase(path, fgdb);
FileGDBAPI::CloseGeodatabase(fgdb);
FileGDBAPI::DeleteGeodatabase(path);
AugusZhan commented 5 years ago

image this question maybe is connect with yous question ,but i don't know why .