Bug 16701 - xcb-image returns NULL
Summary: xcb-image returns NULL
Status: CLOSED NOTABUG
Alias: None
Product: XCB
Classification: Unclassified
Component: Utils (show other bugs)
Version: 1.1
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: Jamey Sharp
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-14 03:36 UTC by Alexander Kerner
Modified: 2008-09-15 11:08 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
testcase (1.10 KB, application/octet-stream)
2008-07-14 04:37 UTC, Mikhail Gusarov
Details

Description Alexander Kerner 2008-07-14 03:36:23 UTC
xcb_image_get returns NULL if called right after the connection is established. 

flames.c from xcb-demo(git version) is a perfect test case. Return value of the xcb_image_get is not being checked and there is a segfailt at the next line. Adding sleep(1) before calling xcb_image_get in flame_draw_flame function solves the problem.


It looks like a timing problem, it depends on the slowness of the machine. There is no problem on a 200mhz arm machine and when it runs in gdb.
Comment 1 Mikhail Gusarov 2008-07-14 04:36:30 UTC
I've found minimal testcase which triggers the problem. Attached.

When any argument is passed to it, it sleeps for a second before obtaining image.

[mag@frontier:~/openinkpot/efl/xcb]% ./test1
(nil)
[mag@frontier:~/openinkpot/efl/xcb]% ./test1 test
0x804c330
[mag@frontier:~/openinkpot/efl/xcb]% 
Comment 2 Mikhail Gusarov 2008-07-14 04:37:11 UTC
Created attachment 17663 [details]
testcase
Comment 3 Bart Massey 2008-09-15 10:50:22 UTC
I think this is not a bug.  You can't do a get_image on an unmapped window; the server refuses.  You're supposed to wait for the mapping event before you try to work with the window.  In practice, it suffices to ensure that the MapWindow request completes: using xcb_map_window_checked() instead of the xcb_flush() that was there is sufficient to fix the problem.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.