[GObject] Error in unref
- From: Uzytkownik <uzytkownik22 gazeta pl>
- To: gtk-app-devel-list gnome org
- Subject: [GObject] Error in unref
- Date: Mon, 25 Jul 2005 11:59:09 +0200
I've this check function:
#include "woc-pager-test.h"
#include "woc-pager-parser.c"
#define TEST(name, cau) g_print(#name "...\t%s\n", cau ? "OK" : "Fail")
void woc_pager_parser_test() {
WocPagerParser *parser = NULL;
TEST(Check GType, WOC_PAGER_PARSER_TYPE);
TEST(Init, parser = g_object_new(WOC_PAGER_PARSER_TYPE, NULL));
g_print("%p\n", parser->scanner);
g_object_unref(parser);
}
It's print address, but after it's error of memory.
Init/fini functions:
static void class_init(gpointer g_class, gpointer class_data) {
GObjectClass *gclass = G_OBJECT_CLASS(g_class);
gclass->finalize = finalize;
}
static void init(GTypeInstance *instance, gpointer g_class) {
WocPagerParser *self = WOC_PAGER_PARSER(instance);
self->scanner = g_scanner_new(NULL);
}
static void finalize(GObject *object) {
WocPagerParser *self = WOC_PAGER_PARSER(object);
g_print("1");
g_scanner_destroy(self->scanner);
g_print("2");
}
And TypeInfo:
static const GTypeInfo info = {
sizeof(WocPagerParserClass),
NULL,
NULL,
class_init,
NULL,
NULL,
sizeof(WocPagerParser),
0,
init,
NULL
};
What do I do wrong? finalize isn't calling
Regards.
--
Linux user: #376500 (patrz http://counter.li.org/)
--
W³ochy i Pary¿ - przewodniki turystyczne do wyboru. Tylko z lipcowym numerem miesiêcznika Auto+.
http://www.a-plus.pl
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]