More allocation logging. I wonder if I can just log directly in the allocators themselves...

This commit is contained in:
Pietro Gagliardi 2015-04-07 22:54:21 -04:00
parent 33b1c29de8
commit 3fc36ec582
5 changed files with 9 additions and 3 deletions

View File

@ -17,7 +17,6 @@ static void uiContainer_dispose(GObject *obj)
static void uiContainer_finalize(GObject *obj)
{
printf("in uiContainer_finalize(); freeing container\n");
G_OBJECT_CLASS(uiContainer_parent_class)->finalize(obj);
}

View File

@ -2,6 +2,10 @@
#include <stdlib.h>
#include "ui.h"
#include <stdio.h>
#define LOGALLOC(p, ty) fprintf(stderr, "%p %s ALLOC\n", p, #ty );
#define LOGFREE(p, ty) fprintf(stderr, "%p %s FREE\n", p, #ty );
typedef struct uiSize uiSize;
typedef struct uiSizing uiSizing;

View File

@ -40,6 +40,7 @@ uiWindow *uiNewWindow(char *title, int width, int height)
uiWindow *w;
w = (uiWindow *) uiAlloc(sizeof (uiWindow));
LOGALLOC(w, uiWindow)
w->w = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, (CGFloat) width, (CGFloat) height)
styleMask:(NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask)

View File

@ -12,7 +12,7 @@ static void onDestroy(GtkWindow *window, gpointer data)
{
uiWindow *w = (uiWindow *) data;
printf("destroying window; freeing uiWindow\n");
LOGFREE(w, uiWindow)
uiFree(w);
}
@ -21,6 +21,7 @@ uiWindow *uiNewWindow(char *title, int width, int height)
uiWindow *w;
w = uiNew(uiWindow);
LOGALLOC(w, uiWindow)
w->widget = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(w->widget), title);
gtk_window_resize(GTK_WINDOW(w->widget), width, height);

View File

@ -46,7 +46,7 @@ static LRESULT CALLBACK uiWindowWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPA
return 0;
break; // fall through to DefWindowProcW()
case WM_DESTROY:
printf("destroying window; freeing uiWindow\n");
LOGFREE(w, uiWindow)
uiFree(w);
break; // fall through to DefWindowProcW()
}
@ -82,6 +82,7 @@ uiWindow *uiNewWindow(char *title, int width, int height)
WCHAR *wtitle;
w = uiNew(uiWindow);
LOGALLOC(w, uiWindow)
w->onClosing = defaultOnClosing;
adjust.left = 0;