Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Extra libraries, Code snippets, applications etc. » OS Problems etc., Win32, POSIX, MacOS, FreeBSD, X11 etc » Font bug in X11
Font bug in X11 [message #9957] Mon, 11 June 2007 15:03 Go to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
This is the simplest test-case I've been able to create:
#include <CtrlLib/CtrlLib.h>
using namespace Upp;

struct Test {
	Font font;
	Test() {font.FaceName("sans serif");}
};
Test t;

GUI_APP_MAIN
{	
	printf("Hello World!");
}

This causes the app to stop at the following point in an X11 library:
Quote:

XAddExtension () from /usr/X11R6/lib/libX11.so.6


This only happens when you set the font in this particular way (perhaps because GUI_APP_MAIN hasn't been run when the font face is set?).

I can understand if this problem is not fixable, but could there please be some sort of #error so it's easier to detect. It has taken me a lot of time to find out what caused this. Test on Slackware (KDE) with dev-3.

James

[Updated on: Mon, 11 June 2007 15:04]

Report message to a moderator

Re: Font bug in X11 [message #10659 is a reply to message #9957] Sat, 21 July 2007 15:30 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Sorry.... yes, anything related to GUI should not be placed in global variable.

Do you have any suggestion how to check this case?

Mirek
Re: Font bug in X11 [message #10683 is a reply to message #9957] Sun, 22 July 2007 00:52 Go to previous message
mr_ped is currently offline  mr_ped
Messages: 825
Registered: November 2005
Location: Czech Republic - Praha
Experienced Contributor
Straight solution is to have "is_inited" global variable for whole GUI thing and check it in every function call (and set it up only after GUI_APP_MAIN is executed), but this will cause lot of overhead...

Maybe in debug mode only?

Another way is to move all GUI functions into "gui" object instance ( UPPgui.font.FaceName("sans serif"); ), which can either be correctly initialized upon instantiation or the first the first instance may be stub with some ERROR() and then the object may be replaced after init with some real GUI object.
(again some overhead).

At compile time without overhead:
external tool after linking binary file to check ctor section to see what is called ahead of APP_MAIN, than scanning all sources for those ctor functions, emulating (interpretating them) and catching all GUI calls... Very Happy Very Happy .. oh well, this one would not really work. Sad

Quote:


"It has taken me a lot of time to find out what caused this."


I'm sort of curious, why did it take so much time? Doesn't it crash in some nice way so you can see the stack and realize it was in FaceName, and ahead of APP_MAIN?
Previous Topic: Mac OS X + 2007.1rc5
Next Topic: NTL bench on XP64 - Just for info
Goto Forum:
  


Current Time: Fri Mar 29 12:40:45 CET 2024

Total time taken to generate the page: 0.01196 seconds