Use C++ memory management for window

This commit is contained in:
Kp 2014-09-17 02:45:23 +00:00
parent e22923e004
commit 2f7b9a7aa7

View file

@ -35,14 +35,9 @@ static window *FirstWindow = NULL;
window *window_create(grs_canvas *src, int x, int y, int w, int h, window_subfunction_t<void>::type event_callback, void *data)
{
window *wind;
window *prev = window_get_front();
d_event event;
MALLOC(wind, window, 1);
if (wind == NULL)
return NULL;
window *wind = new window;
Assert(src != NULL);
Assert(event_callback != NULL);
gr_init_sub_canvas(&wind->w_canv, src, x, y, w, h);
@ -100,7 +95,7 @@ int window_close(window *wind)
event.type = EVENT_WINDOW_CLOSED;
w_callback(wind, &event, NULL); // callback needs to recognise this is a NULL pointer!
d_free(wind);
delete wind;
return 1;
}