g_return

Neil Williams linux at codehelp.co.uk
Fri Aug 13 06:25:47 EDT 2004


On Friday 13 August 2004 12:17, Derek Atkins wrote:
> Very odd...

I agree, it took a bit of hunting to find it! I'm going to have to do some 
more hunting to find out WHY it works and what has changed to make it 
necessary.

> I don't see why this should be required.  We never 
> set G_LOG_DOMAIN anywhere in our code,

I know, I grep'd for G_LOG_DOMAIN and found nothing. It seemed logical for it 
to be involved somehow so I tried it. There must be something else that sets 
a value (presumably blank) as a side-effect of another config. i.e. a bug - 
whether it's in glib.h or somewhere in gnc_engine_init, I can't tell. I'm 
going to try and reproduce it on another Debian unstable box.

> and it's always worked just 
> fine.  Is something, somehow, setting G_DISABLE_CHECKS?

I did try #undef G_DISABLE_CHECKS before using G_LOG_DOMAIN. Undefining 
G_DISABLE_CHECKS had no effect, with or without G_LOG_DOMAIN.

It was a test program that shows the effect best. g_message and g_return... 
work as expected before gnc_engine_init is called. After that, they are 
silent. Only by setting the log domain are the calls executed properly.

e.g. in this snippet:
	/* engine initialising */
	g_message("engine initialising . . \n");
	printf("Gnucash Version %i.%i.%i\n", gnucash_major_version(),
		gnucash_minor_version(), gnucash_micro_version());
	gnc_engine_init(argc, argv);
	
	/* creating test data */
	g_message("Creating test data\n");

Without G_LOG_DOMAIN being tweaked, the first g_message is displayed, the 
second is ignored. With the tweak, both are displayed. Interestingly, it is 
FILE SPECIFIC. By putting the tweak only in the qof_book_merge.c file, only 
those warnings in the main merge code are displayed. Putting it into the test 
file enables the messages generated in the test file C to still be displayed 
after gnc_engine_init. 

-- 

Neil Williams
=============
http://www.codehelp.co.uk/
http://www.dclug.org.uk/
http://www.isbn.org.uk/
http://sourceforge.net/projects/isbnsearch/

http://www.biglumber.com/x/web?qs=0x8801094A28BCB3E3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
Url : http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20040813/42c7440d/attachment.bin


More information about the gnucash-devel mailing list