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 » U++ Library support » U++ Library : Other (not classified elsewhere) » LibX11 error & lock-up in debug mode with GridCtrl
LibX11 error & lock-up in debug mode with GridCtrl [message #35141] Mon, 16 January 2012 22:22 Go to next message
dolik.rce is currently offline  dolik.rce
Messages: 1758
Registered: August 2008
Location: Czech Republic
Senior Contributor

Hi everyone,

I've been experiencing very weird problem with CtrlCore and GridCtrl in debug mode on Linux. Everything works just fine in optimal or when I don't use GridCtrl package. As soon as I just add GridCtrl to my package, without even including the GridCtrl.h, things go wrong. The application throws this on stderr:
Quote:

The program 'guitest' received an X Window System error.
This probably reflects a bug in the program.
The error was 'RenderBadPicture (invalid Picture parameter)'.
(Details: serial 118 error_code 160 request_code 148 minor_code 7)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the --sync command line
option to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)

Then it runs forever, taking 100% of CPU resources. When I run it in debugger and stop it at random, I always get this backtrace:
Quote:

#0 0xb771172d in _XReply () from /usr/lib/libX11.so.6
#1 0xb770cec6 in XSync () from /usr/lib/libX11.so.6
#2 0xb76ecf96 in XCloseDisplay () from /usr/lib/libX11.so.6
#3 0x0822f4b3 in Upp::s__sF26_46_fn () at /home/h/upp-production/uppsrc/CtrlCore/DrawX11.cpp:50
#4 0xb71ce0e1 in __run_exit_handlers () from /lib/libc.so.6
#5 0xb71ce16d in exit () from /lib/libc.so.6
#6 0xb7b13500 in ?? () from /usr/lib/libgdk-x11-2.0.so.0
#7 0xb7713ca3 in _XError () from /usr/lib/libX11.so.6
#8 0xb771093d in ?? () from /usr/lib/libX11.so.6
#9 0xb7710997 in ?? () from /usr/lib/libX11.so.6
#10 0xb7711850 in _XReply () from /usr/lib/libX11.so.6
#11 0xb76f4e0e in XGetGeometry () from /usr/lib/libX11.so.6
#12 0xb7b14a2c in gdk_pixmap_foreign_new_for_display () from /usr/lib/libgdk-x11-2.0.so.0
#13 0xb7b14a88 in gdk_pixmap_foreign_new () from /usr/lib/libgdk-x11-2.0.so.0
#14 0x081952e3 in Upp::GetGTK (widget=0x86ef8e0, state=0, shadow=2, detail=0x83e7d1d "radiobutton", type=18, cx=17, cy=17, rect=...)
at /home/h/upp-production/uppsrc/CtrlLib/ChGtk0.cpp:146
#15 0x081979bb in Upp::GtkIml (uii=0, w=0x86ef8e0, shadow=2, state=0, detail=0x83e7d1d "radiobutton", type=18, cx=17, cy=17, rect=...)
at /home/h/upp-production/uppsrc/CtrlLib/ChGtk0.cpp:417
#16 0x08197aec in Upp::GtkIml (uii=0, w=0x86ef8e0, shadow=2, detail=0x83e7d1d "radiobutton", type=18, cx=17, cy=17, rect=...)
at /home/h/upp-production/uppsrc/CtrlLib/ChGtk0.cpp:423
#17 0x0819d1fa in Upp::ChHostSkin () at /home/h/upp-production/uppsrc/CtrlLib/ChGtk.cpp:151
#18 0x0820ea2f in Upp::Ctrl::ReSkin () at /home/h/upp-production/uppsrc/CtrlCore/Ctrl.cpp:916
#19 0x0828dcd6 in Upp::Font::SetStdFont (font=...) at /home/h/upp-production/uppsrc/Draw/Font.cpp:111
#20 0x082306c1 in Upp::InitX11Draw (display=0x8674c00) at /home/h/upp-production/uppsrc/CtrlCore/DrawX11.cpp:220
#21 0x082308a9 in Upp::InitX11Draw (dispname=0x0) at /home/h/upp-production/uppsrc/CtrlCore/DrawX11.cpp:242
#22 0x0824cb2a in Upp::Ctrl::InitX11 (display=0x0) at /home/h/upp-production/uppsrc/CtrlCore/X11App.cpp:400
#23 0x0804e9dc in main (argc=1, argv=0xbffff9b4, envptr=0xbffff9bc) at /home/h/MyApps/guitest/main.cpp:13

So as far as I can tell, some bad X11 error happens, U++ tries to cleanup and exit and the EXITBLOCK code from DrawX11.cpp results in infinite loop over or inside _XReply(). Since it happens even when GridCtrl.h is not included, I suspected some INIT/EXITBLOCKs in GridCtrl, but I haven't found any. Is there something else that registers itself even if the code is not called directly? Or perhaps something in CtrlCore that reacts to GridCtrl presence?

Oh, and I forgot to mention that this happens with both GCC 4.6.2 and Clang 3.0. It also happens with NOGTK flag, but then the error is different:
Quote:

X Error of failed request: RenderBadPicture (invalid Picture parameter)
Major opcode of failed request: 148 (RENDER)
Minor opcode of failed request: 7 (RenderFreePicture)
Picture id in failed request: 0x17
Serial number of failed request: 10
Current serial number in output stream: 91


Can anyone reproduce this weird behavior? Or is it just something rotten in my system?

Best regards,
Honza
Re: LibX11 error & lock-up in debug mode with GridCtrl [message #35143 is a reply to message #35141] Mon, 16 January 2012 23:15 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 2991
Registered: August 2008
Veteran
Hello Honza

An U++ user had exactly the same problem few days ago and I could not find the reason... and the program includes GridCtrl too.

Good find!


Best regards
Iñaki
Re: LibX11 error & lock-up in debug mode with GridCtrl [message #35145 is a reply to message #35143] Mon, 16 January 2012 23:56 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 2991
Registered: August 2008
Veteran
Hello Honza

I have just tested in other environment HomeBudget, GridCtrlTest and a big program that had the same problem and, they work perfectly!!!

- gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
- Ubuntu 10.04
- Latest svn U++


Best regards
Iñaki
Re: LibX11 error & lock-up in debug mode with GridCtrl [message #35181 is a reply to message #35145] Thu, 19 January 2012 22:36 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 2991
Registered: August 2008
Veteran
Hello Honza

Do you know anything new?


Best regards
Iñaki
Re: LibX11 error & lock-up in debug mode with GridCtrl [message #35188 is a reply to message #35181] Fri, 20 January 2012 22:04 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1758
Registered: August 2008
Location: Czech Republic
Senior Contributor

koldo wrote on Thu, 19 January 2012 22:36

Hello Honza

Do you know anything new?

I've got a little success today - I found out that the issue is BLITZ related. When I turn off BLITZ for GridCtrl, the problem disappears. So far I didn't figure out which file or combination of files causes it, so investigation continues...

Honza
Re: LibX11 error & lock-up in debug mode with GridCtrl [message #35189 is a reply to message #35141] Fri, 20 January 2012 23:34 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1758
Registered: August 2008
Location: Czech Republic
Senior Contributor

Finally got it Smile And it is not really BLITZ related... it is much more complicated Smile

After a lot of commenting out of different parts of code I narrowed it down to single line: GridDisplay.cpp:36. There, in SetTheme() is an indirect call to GridImg::Vhdr6(), which is a default header theme defined in GridCtrl.iml. Now this function gets called when global variable GridDisplay StdGridDisplay is initialized. I'm still not 100% certain what exactly happens, but I believe it is wrong initialization order. Probably StdGridDisplay is initialized before GridImg or something like that. It would also explain why it happens only in some modes and on some systems - the order of initialization can be implementation dependent.

I looked through all the code in trunk, but StdGridDisplay seems to not be used anywhere. So I think it won't break much if just fix the problem by transforming the global variable to function, so that it is initialized later (upon the first use, note that this might also save some memory Wink ):
//GridDisplay.cpp:11
GLOBAL_VAR(GridDisplay, StdGridDisplay);
//GridDisplay.h:106
UPP::GridDisplay& StdGridDisplay();

What do you think Daniel, is this fix possible? I know it might break someones application, but the fix in that case would be trivial (just adding "()"), so it is not really bad, right?

Honza
Re: LibX11 error & lock-up in debug mode with GridCtrl [message #35190 is a reply to message #35189] Sat, 21 January 2012 10:40 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 2991
Registered: August 2008
Veteran
Shocked

Best regards
Iñaki
Re: LibX11 error & lock-up in debug mode with GridCtrl [message #35191 is a reply to message #35190] Sat, 21 January 2012 11:40 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1758
Registered: August 2008
Location: Czech Republic
Senior Contributor

koldo wrote on Sat, 21 January 2012 10:40

Shocked
I guess this is exactly why people often say that global variables are bad Very Happy
Re: LibX11 error & lock-up in debug mode with GridCtrl [message #35193 is a reply to message #35189] Sat, 21 January 2012 12:43 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1354
Registered: November 2005
Location: Poland
Senior Contributor

dolik.rce wrote on Fri, 20 January 2012 17:34

Finally got it Smile And it is not really BLITZ related... it is much more complicated Smile

//GridDisplay.cpp:11
GLOBAL_VAR(GridDisplay, StdGridDisplay);
//GridDisplay.h:106
UPP::GridDisplay& StdGridDisplay();

What do you think Daniel, is this fix possible? I know it might break someones application, but the fix in that case would be trivial (just adding "()"), so it is not really bad, right?

Honza

Hi Honza. Thank you for tracking this down! I really appreciate this. And yes, the fix seems to be good. I don't even remember if I ever used StdGridDisplay...
Re: LibX11 error & lock-up in debug mode with GridCtrl [message #35195 is a reply to message #35193] Sat, 21 January 2012 15:09 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12022
Registered: November 2005
Ultimate Member
unodgs wrote on Sat, 21 January 2012 06:43

dolik.rce wrote on Fri, 20 January 2012 17:34

Finally got it Smile And it is not really BLITZ related... it is much more complicated Smile

//GridDisplay.cpp:11
GLOBAL_VAR(GridDisplay, StdGridDisplay);
//GridDisplay.h:106
UPP::GridDisplay& StdGridDisplay();

What do you think Daniel, is this fix possible? I know it might break someones application, but the fix in that case would be trivial (just adding "()"), so it is not really bad, right?

Honza

Hi Honza. Thank you for tracking this down! I really appreciate this. And yes, the fix seems to be good. I don't even remember if I ever used StdGridDisplay...


Patch applied. Have to admit that it is strange anyway, I have not found a way how order of initialization could break this. But I was only looking for 30 minutes or so...
Re: LibX11 error & lock-up in debug mode with GridCtrl [message #35196 is a reply to message #35195] Sat, 21 January 2012 18:41 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 2991
Registered: August 2008
Veteran
Hello Mirek

It good be good if INITBLOCK() could start in the same order in all platforms. Is it possible?


Best regards
Iñaki
Re: LibX11 error & lock-up in debug mode with GridCtrl [message #35202 is a reply to message #35196] Sun, 22 January 2012 01:12 Go to previous messageGo to next message
nixnixnix is currently offline  nixnixnix
Messages: 415
Registered: February 2007
Location: Kelowna, British Columbia
Senior Member
Cool!

I still get that same error with version 4451 on Ubuntu 11.10 but am guessing the sources didn't update yet. Will try it again tomorrow.

Nick
Re: LibX11 error & lock-up in debug mode with GridCtrl [message #35204 is a reply to message #35196] Sun, 22 January 2012 10:28 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12022
Registered: November 2005
Ultimate Member
koldo wrote on Sat, 21 January 2012 12:41

Hello Mirek

It good be good if INITBLOCK() could start in the same order in all platforms. Is it possible?


Unfortunately, no. You have to design your code around this limitation (which usually is quite simple).
Re: LibX11 error & lock-up in debug mode with GridCtrl [message #35205 is a reply to message #35202] Sun, 22 January 2012 10:29 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12022
Registered: November 2005
Ultimate Member
nixnixnix wrote on Sat, 21 January 2012 19:12

Cool!

I still get that same error with version 4451 on Ubuntu 11.10 but am guessing the sources didn't update yet. Will try it again tomorrow.

Nick


It is fixed by revision 4454.

Mirek
Re: LibX11 error & lock-up in debug mode with GridCtrl [message #35210 is a reply to message #35205] Sun, 22 January 2012 19:09 Go to previous messageGo to next message
nixnixnix is currently offline  nixnixnix
Messages: 415
Registered: February 2007
Location: Kelowna, British Columbia
Senior Member
Am now using UPP4458 and I get exactly the same behaviour. I have cleaned and rebuilt all. Is there anything else I need to do please?

Koldo has my code. I am attempting to build a 64bit exe under Ubuntu 11.10 and I get the "RenderBadPicture" error with the window not showing and the exe using one CPU almost 100%.

Nick

EDIT: Honza, I am using "sudo apt-get upgrade theide" in order to move to the latest version. Is this correct? Do I need to uninstall completely and install again?

[Updated on: Sun, 22 January 2012 19:33]

Report message to a moderator

Re: LibX11 error & lock-up in debug mode with GridCtrl [message #35211 is a reply to message #35210] Sun, 22 January 2012 20:17 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1758
Registered: August 2008
Location: Czech Republic
Senior Contributor

nixnixnix wrote on Sun, 22 January 2012 19:09

EDIT: Honza, I am using "sudo apt-get upgrade theide" in order to move to the latest version. Is this correct? Do I need to uninstall completely and install again?
That depends on how you manage U++ sources. If you use SVN or git, then apt-get upgrade theide is fine. If you use sources from upp package, you should also upgrade upp: "sudo apt-get upgrade upp theide". In that case you should also have theide set up to sync the sources from /usr/share/upp to your home directory.

Honza
icon14.gif  Re: LibX11 error & lock-up in debug mode with GridCtrl [message #35218 is a reply to message #35211] Mon, 23 January 2012 16:41 Go to previous message
nixnixnix is currently offline  nixnixnix
Messages: 415
Registered: February 2007
Location: Kelowna, British Columbia
Senior Member
Hey Honza,

The latest version of upp does not install for some reason. I thought it was me so I destroyed my virtual machine and made a new one from a clean install of Ubuntu 11.10.

When I run theIDE for the first time it tries to install to

/home/user/upp/upp/upp/upp/upp/upp/upp/upp/upp/... and so on and fails.

So far I have not been able to try the fix from this thread.

Cheers,

Nick

EDIT: love you guys - you always come through Laughing my software is up and working on Ubuntu 11.10 using UPP 4500. Fantastic!

[Updated on: Wed, 01 February 2012 19:37]

Report message to a moderator

Previous Topic: Error in Web Package example... for sockets
Next Topic: Static assertion
Goto Forum:
  


Current Time: Sun Sep 22 07:42:20 CEST 2019

Total time taken to generate the page: 0.01012 seconds