fixed void pointer delete bug

develop
doomchild 2010-05-04 04:50:43 +08:00 committed by RusAnon
parent 2b04c0f662
commit ada8da8422
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;
} }
} }