Index: [thread] [date] [subject] [author]
  From: Marcus Sundberg <mackan@stacken.kth.se>
  To  : creichen@rbg.informatik.tu-darmstadt.de
  Date: Tue, 11 May 1999 20:55:38 +0000

Re: libggi troubles on sparc-sun-solaris2.5

Christoph Reichenbach wrote:
> 
> Hi,
> 
> I'm having troubles with GGI on Solaris. The problem occurs when I try
> to
> run a program compiled for libggi (snapshot 05/11) over an ssh
> connection:
> ggiOpen() opens a visual (an empty X window), but does not return

If you get a window it means that ggiOpen succeeded and that at 
least one successful SetMode call was done.

> Setting GGI_DEBUG=255 produced the following output:
> 
> LibGII: Debugging=255
> LibGGI: Debugging=255
> LibGGI: ggiOpen("display-x:saturn:5.0") called
> LibGGI: Loading driver display-x:saturn:5.0
> LibGGI: _ggiAddDL(392a00, "display-x", "saturn:5.0", 0x1) called
> LibGGI: _ggiLoadDL("/home/jameson/lib/ggi/display/X.so", 0x1) called
> LibGGI: hand.handle=ef7c083c
> LibGGI: hand.init=ef5c1730
> LibGGI: hand.cleanup=ef5c1dbc
> LibGGI: _ggiLoadDL returned 36668
> LibGGI: X-target wants display saturn:5.0
> LibGGI: X: has display saturn:5.0
> LibGGI: X: has screen 0
> LibGGI: _ggiAddDL(392a00, "helper-mansync", "(null)", 0x0) called
> LibGGI: _ggiLoadDL("/home/jameson/lib/ggi/display/mansync.so", 0x0)
> called
> LibGGI: hand.handle=ef7c14c4
> LibGGI: hand.init=eebe104c
> LibGGI: hand.cleanup=eebe10e0
> LibGGI: _ggiLoadDL returned 36848
> LibGGI: 0 = dlh->init(392a00,"(null)",28480) - helper-mansync
> LibGGI: X: Enabling use of XSHM extension
> LibGGI: _GGI_mansync_init(): nrvisuals = 1
> LibGII: Allocating input structure
> LibGII: _giiEvQueueAllocate(378898) called
> LibGII: Got queue_set: 15b5a0
> LibGII: giiOpen adding "xwin", "", efffe570
> LibGII: _giiLoadDL("xwin","Segmentation Fault (core dumped)

Ah, thanks for finding that one. What you see here is a problem with
Solaris fprintf() not handling NULL pointer strings. The following
patch will fix that:

Index: gii/dl.c
===================================================================
RCS file: /projects/ggi/cvsdevel/degas/lib/libgii/gii/dl.c,v
retrieving revision 1.3
diff -u -r1.3 dl.c
--- dl.c        1999/02/20 19:44:27     1.3
+++ dl.c        1999/05/11 19:37:33
@@ -39,7 +39,8 @@
 {
        gii_dlhandle hand,*hp;
 
-       GIIDPRINT_LIBS("_giiLoadDL(\"%s\",\"%s\") called \n", name,
version);
+       GIIDPRINT_LIBS("_giiLoadDL(\"%s\",\"%s\") called \n", name,
+                      version ? version : "(NULL)");
 
        hand.handle=ggMLoadModule(_giiconfhandle, name, version, 0);
 
=====================================================================

However I assume you first tried running the program without debugging.
In that case this bug isn't triggered, so there must be another problem
as well. Please apply the diff and see what it says with GGI_DEBUG=255
then.

> ggiOpen() is called by this function:
> 
> ggi_visual_t openVisual()
> {
>   ggi_mode mode = {
>     1, // 1 frame
>     {320,200}, // resolution
>     {320,200}, // virtual
>
>     {0,0},     // size in mm

Some good coding practise:
You should use GGI_AUTO for virtual and size, and also use CheckMode
before SetMode to avoid warnings about invalid modes being printed.

>     GT_AUTO,   // color depth
>     {GGI_AUTO,GGI_AUTO}}; // font size
>   ggi_visual_t retval;
> 
>   retval = ggiOpen(NULL);

Don't forget to check the return code here.

>   if (ggiSetMode(retval, &mode)) {
>     fprintf(stderr,"Evading to different mode...\n");
>     if (ggiSetMode(retval, &mode)) return NULL;
>   }
> 
>   if (colors_uninitialized) {
>     initColors(retval);
>     colors_uninitialized = 0;
>   }
> 
>   return retval;
> }

//Marcus
-- 
-------------------------------+------------------------------------
        Marcus Sundberg        | http://www.stacken.kth.se/~mackan/
 Royal Institute of Technology |       Phone: +46 707 295404
       Stockholm, Sweden       |   E-Mail: mackan@stacken.kth.se

Index: [thread] [date] [subject] [author]