fixed void pointer delete bug

develop
doomchild 2010-05-03 15:50:43 -05:00
parent 64f1e47716
commit 417ce7953e
1 changed files with 4 additions and 1 deletions

@ -49,11 +49,14 @@ DFHackObject* API_Alloc(const char* path_to_xml)
} }
//FIXME: X:\dfhack\DFHackAPI_C.cpp:56: warning: deleting `DFHackObject* ' is undefined //FIXME: X:\dfhack\DFHackAPI_C.cpp:56: warning: deleting `DFHackObject* ' is undefined
//DC: Yeah, I forgot that trying to delete a void pointer might be a bad idea. This works now.
void API_Free(DFHackObject* api) void API_Free(DFHackObject* api)
{ {
if(api != NULL) if(api != NULL)
{ {
delete api; DFHack::API* a = (DFHack::API*)api;
delete a;
api = NULL; api = NULL;
} }
} }