From ada8da84224c1e84ca37014c1fce47e5fb674768 Mon Sep 17 00:00:00 2001 From: doomchild Date: Tue, 4 May 2010 04:50:43 +0800 Subject: [PATCH] fixed void pointer delete bug --- dfhack/DFHackAPI_C.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dfhack/DFHackAPI_C.cpp b/dfhack/DFHackAPI_C.cpp index b9ebb76a9..e7bf624b0 100644 --- a/dfhack/DFHackAPI_C.cpp +++ b/dfhack/DFHackAPI_C.cpp @@ -49,11 +49,14 @@ DFHackObject* API_Alloc(const char* path_to_xml) } //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) { if(api != NULL) { - delete api; + DFHack::API* a = (DFHack::API*)api; + delete a; + api = NULL; } }