Re: [GObject] Error in unref



Dnia 25-07-2005, pon o godzinie 15:21 +0100, Tim MÃller napisaÅ(a):
On Monday 25 July 2005 10:14, Uzytkownik wrote:

#define TEST(name, cau) g_print(#name "...\t%s\n", cau ? "OK" : "Fail")

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.
  ...
What do I do wrong? finalize isn't calling

You've shot yourself in the foot with that macro. Here's a hint - try this:

  g_print ("%s\n", parser->scanner);

and then think about why that prints "OK" and what exactly your macro expands 
to ... :-P


I'm stupid :) - I didn't remember "Be careful with macros"
This is what is wrong :)
Now all it's OK.

Cheers
 -Tim

PS: it should work as expected if you put brackets around the cau in the macro 
definition

I forgot it.

Thank you very much.

Best regards.


-- 
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]