help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] GNU Smalltalk crashes when calling xcb_create_windo


From: Gwenael Casaccio
Subject: Re: [Help-smalltalk] GNU Smalltalk crashes when calling xcb_create_window via cCall
Date: Mon, 28 Sep 2009 22:46:35 +0200

Hi,

Here is the solution without any additional c code ;)

Cheers,
Gwenael

On Tue, 2009-09-29 at 00:38 +0400, Dmitry Matveev wrote:
> Hello everybody!
> 
> It's me with my incomplete-xcb-binding again...
> 
> To create a window with XCB, I have to call the xcb_create_window()
> function. It has the following prototype:
> 
> xcb_void_cookie_t
> xcb_create_window (xcb_connection_t *c,
>                    uint8_t           depth,
>                    xcb_window_t      wid,
>                    xcb_window_t      parent,
>                    int16_t           x,
>                    int16_t           y,
>                    uint16_t          width,
>                    uint16_t          height,
>                    uint16_t          border_width,
>                    uint16_t          _class,
>                    xcb_visualid_t    visual,
>                    uint32_t          value_mask,
>                    const uint32_t   *value_list);
> 
> I wrote the following Smalltalk code to call this function:
> Xcb class >> createWindow: aConnection depth: aDepth windowId: wID
>     parent: parentID x: posX y: poxY width: aWidth height: aHeight
>     borderWidth: bWidth class: aClass visual: aVisual valueMask: aMask
>     valueList: aList [
>         <cCall: 'xcb_create_window' returning: #void args:
>             #(#cObject #char #uInt #uInt #short #short #ushort #ushort
> #ushort #ushort #uInt #uInt #cObject)>
>     ]
> (Yes, its ugly)
> 
> When I execute it, I get
> `--> gst -f xcbroot.st
> xcbroot.st:94: Aborted
> xcbroot.st:94: Error occurred while not in byte code interpreter!!
> /lib/i686/cmov/libc.so.6(abort+0x188)[0xb7cd3d68]
> /usr/local/bin/../lib/libgst.so.7[0xb7e76d19]
> zsh: abort      gst -f xcbroot.st
> 
> If I will write simple wrapper in my library like...
> 
> void
> gst_xcb_create_window
>     (...the same arguments as for xcb_create_window...)
> {
>     xcb_create_window (...the arguments...);
> }
> 
> ...and if I will use it instead of "native" xcb functions, e.g.
> 
>     <cCall: 'gst_xcb_create_window' ...>
> 
> everything will work fine. I've found that only two xcb functions need
> such wrappers: xcb_create_window and xcb_map_window.
> 
> Is it a GNU Smalltalk bug? Why calls to my own library with the same
> functions work? Or I have buggy xcb that is can not be bound... All I
> want is just to make this world a bit better :)
> 
> With best regards,
> Dmitry Matveev
> 
> P.S. Attachments:
>  * gst-crash-gdb.txt - the GDB output (run & bt) when GST crashes
> (direct calls to xcb functions). I hope it will be useful
>  * xcbroot.st - the "binding"
>  * xcb-gst.c - the wrappers
> 
> P.P.S `--> uname -a
> Linux debian 2.6.26-2-686 #1 SMP Sun Jun 21 04:57:38 UTC 2009 i686 GNU/Linux
> _______________________________________________
> help-smalltalk mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-smalltalk

Attachment: xcbroot.st
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]