From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103734,fe9dd44acd5462d1 X-Google-Attributes: gid103734,public X-Google-Thread: 103376,fe9dd44acd5462d1 X-Google-Attributes: gid103376,public X-Google-Thread: 10b6ac,fe9dd44acd5462d1 X-Google-Attributes: gid10b6ac,public From: cgreen@yosemite.atc.com (Christopher Green) Subject: Re: Ada and X/Motif Date: 1997/06/09 Message-ID: <5nhbov$9m9@newshub.atmnet.net>#1/1 X-Deja-AN: 247276367 Distribution: inet References: <3394CED4.2BF7@interlog.com> Organization: Advanced Technology Center, Laguna Hills, CA Newsgroups: comp.lang.ada,comp.windows.x,comp.windows.x.motif Date: 1997-06-09T00:00:00+00:00 List-Id: In article <3394CED4.2BF7@interlog.com>, Uliyana Markova wrote: >I am programming a user interface in Ada using X/Motif routines. The >interface between X and Ada is implemented through X bindings. >I have the following problem: to create a colormap, allocate colors >and store a color I call consequently the bindings for >XCreateColormap, XAllocColorCells and XStoreColor. When these >functions are called in the main ada routine, they work properly. >If I call any (or all) of the above functions in a separate procedure >and then call this procedure in the main routine, the XStoreColor >function does not store the color in the colormap. There is no error >message, just the function does not do what it is supposed to do. Any >help? Any chance you could post or email an example, and provide information on what Ada compiler, set of bindings, and X11 implementation you are using? Since XStoreColor() does not return a status to indicate whether it succeeded, the only way to determine whether the color was stored is to observe it on the display. For this to happen, the colormap must also have been installed; XSetWindowColormap() does this (actually, the window manager detects the colormap change and installs the color- map). So either XSetWindowColormap() must also be called in the sub- program; or the subprogram must return the colormap, and the main pro- gram must call XSetWindowColormap(). Just as a place to start looking, I'd look for variables that may not be correctly passed between main and subprogram, or variables that do not have an adequate lifetime when the binding functions are called from the subprogram. Remember that many X Window System objects are represented by C pointers, and a C pointer to a local variable becomes a dangling pointer when the subprogram returns. Chris Green Email cgreen@atc.com Advanced Technology Center Phone (714) 583-9119 22982 Mill Creek Drive ext. 220 Laguna Hills, CA 92653 Fax (714) 583-9213