答复: A question about XOpenDisplay fail
Ma, Qingyu (GE Healthcare)
Qingyu.Ma at ge.com
Wed Apr 28 04:34:36 PDT 2010
Thanks for your reply.
My process is executed in a script which is executed by another process. The script is like:
I know when myProcess opens display, current DISPLAY maybe changed back to :0.0. It's another issue. But till now, myProcess is displayed on :0.1 each time.
Of course, I'm not sure if myProcess try to open display at the right point of changing DISPLAY, whether it can get a valid display (0 or 1)?
Is there any other possibility to cause XOpenDisplay fail, like network, IP stack or anything?
发件人: Peter Hutterer [mailto:peter.hutterer at who-t.net]
发送时间: 2010年4月28日 19:18
收件人: Ma, Qingyu (GE Healthcare)
抄送: xorg at lists.freedesktop.org
主题: Re: A question about XOpenDisplay fail
On Wed, Apr 28, 2010 at 02:50:50PM +0800, Ma, Qingyu (GE Healthcare) wrote:
> During my developing work, I meet a problem about XOpenDisplay. Could
> you please give me some consult?
please don't cross-post. taking xorg-devel off the CC list.
> I'm developing a system, which uses fvwm as WM. Two fvwm are executed
> to implement two separated screens. My process is displayed on one
> screen(DISPLAY). It calls XOpenDisplay(NULL) to get one Display
> connection to be used as display image, and another Display to be used
> as toggle keyboard led (whenever keyboard led state is changed, a new
> Display is opened and closed). The function is OK. But when I was
> doing monkey and cycle test, there is a very very little possibility
> that my process may crash. I looked through my code, and found a bug
> which was that I didn't check the return value of XOpenDisplay, and
> use it directly . I have checked that a NULL Display will cause
> process crash in following code. It's just my analysis and guess, I'm
> not sure whether it does be the root cause. And, by now, the cycle and
> monkey cannot re-occur the issue.
> So, I want to get some information from you to help to reach the root
> cause. What will cause XOpenDisplay return NULL? How can I simulate
> the case?(When my process is executed, I'm sure the XWindow and fvwm
> have been booted up.)
XOpenDisplay on an invalid display will return NULL. so you can either specify an invalid display in the code directly or through your DISPLAY environment variable.
should fail, unless you really have an X server on display 10 which is rather unlikely.
More information about the xorg