|
|
Home » Extra libraries, Code snippets, applications etc. » OS Problems etc., Win32, POSIX, MacOS, FreeBSD, X11 etc » Untrivial EditString bug(?) in FreeBSD(and may be all POSIX)
Untrivial EditString bug(?) in FreeBSD(and may be all POSIX) [message #20725] |
Wed, 01 April 2009 23:21  |
Mindtraveller
Messages: 917 Registered: August 2007 Location: Russia, Moscow rgn.
|
Experienced Contributor |

|
|
I develop some app for both Windows and FreeBSD systems. Last code changes revealed very untrivial (from my point of view) behaviour in POSIX systems. When compiled and linked, application is executed in Windows flawlessly without any runtime errors. In FreeBSD the same application causes segmentation fault on startup.
I dag into the source of this fault.
So the fault happens when static EditString class member is appeared.
It looks like this:
//.h
class AAA {static EditString es;};
//.cpp
//...
EditString AAA::es;
Debugger shows call stack when this fault happens:
Quote: | XInternAtom () from /usr/local/lib/libX11.so.6
Upp::XAtom ()
Upp::Ctrl::IsCompositedGui ()
Upp::Ctrl::Ctrl ()
Upp::EditField::EditField ()
Upp::EditValue<Upp::WString, Upp::ConvertString>::EditValue ()
Upp::EditString::EditString ()
|
If I make this EditString non-static, application runs flawlessly without faults. It seems like something in EditString ctor causes big segmentation fault when executed on program start, in the globals initialization period.
[Updated on: Wed, 01 April 2009 23:23] Report message to a moderator
|
|
|
|
|
Re: Untrivial EditString bug(?) in FreeBSD(and may be all POSIX) [message #20756 is a reply to message #20755] |
Sat, 04 April 2009 22:39   |
Mindtraveller
Messages: 917 Registered: August 2007 Location: Russia, Moscow rgn.
|
Experienced Contributor |

|
|
IMO this fact [slightly] violates "everything belongs somewhere" rule, which is one of the mains of U++.
Maybe it will be wiser to have everything possible to be static (global), but the real initialization should be postponed to the first draw/paint attempt? Of maybe it would be wiser to have internal controls list, which is initialized when it is possible?
In any way, this is crucial development information. And IMO it should be resided somewhere to be seen by everyone (i.e. in the beginning of GUI tutorial).
[Updated on: Sat, 04 April 2009 22:53] Report message to a moderator
|
|
|
|
|
Re: Untrivial EditString bug(?) in FreeBSD(and may be all POSIX) [message #20772 is a reply to message #20765] |
Sun, 05 April 2009 23:22   |
Mindtraveller
Messages: 917 Registered: August 2007 Location: Russia, Moscow rgn.
|
Experienced Contributor |

|
|
Thank you!
Mirek, could you please tell what is your typical solution to avoid static controls? How do you then manage controls shared between a number of objects of the same class.
To move this question into more practical area, I`ll post the exact situation.
Application works with a scheme. Scheme consists of scheme elements. Elements are of different types. Clicking some element on the scheme drawn shows edit control in the toolbar. And the type of this controls depends on element type.
So I have a number of SchemeElement descendants
SchemeElementAAA : SchemeElement
SchemeElementBBB : SchemeElement
SchemeElementCCC : SchemeElement
and each of these classes has shared control (which is of course static).
There is of course a number of possible solutions, but IMO it would be wiser to hear one from a man who solved it many times before.
[Updated on: Sun, 05 April 2009 23:24] Report message to a moderator
|
|
|
|
|
Goto Forum:
Current Time: Mon May 12 22:59:03 CEST 2025
Total time taken to generate the page: 0.00547 seconds
|
|
|