Hi,
initializing libggi more than once fails 'sometimes'.
I've attached an example which sometimes works, but sometimes
it works only the first time and fails the second time. Then
the program generates (if GGI_DEBUG=1):
LibGGI: _GGI_mansync_init(): nrvisuals = 1
LibGGI: _GGI_mansync_start() (MANSYNC_CHILD) called.
hit any key to finish
LibGGI: _GGI_mansync_stop() (MANSYNC_CHILD) called.
Xlib: connection to ":0.0" refused by server
Xlib: XDM authorization key matches an existing client!
LibGGI: display-fbdev: GGIdlinit start.
display-fbdev: ioctl(VT_GETSTATE) failed: Invalid argument
L/vtswitch: You are not running on a virtual console and do not have
permission to open a new one
display-fbdev: Couldn't open framebuffer device /dev/fb/0: No such file or
directory
display-fbdev: Couldn't open framebuffer device /dev/fb0: Permission denied
LibGGI: display-fbdev: GGIdlcleanup start.
Segmentation fault (core dumped)
The first time it seems to open correctly the X target, the second
time this seems to fail.
This is eventually to a SEGFAULT which I reported earlier, and which
also only occurs, if initializing - exiting more than once. The gdb
output in this case is:
Program received signal SIGSEGV, Segmentation fault.
GGI_X_flush (vis=0x81bc288, x=0, y=0, w=640, h=480, tryflag=1) at
../../../libggi/display/X/mode.c:156
156 xcol.red = vis->palette[x].r;
(gdb) where
#0 GGI_X_flush (vis=0x81bc288, x=0, y=0, w=640, h=480, tryflag=1) at
../../../libggi/display/X/mode.c:156
#1 0x4015ed40 in ggiFlush (vis=0x81bc288) at ../../libggi/ggi/stubs.c:70
#2 0x4015cc5e in ggiSetMode (vis=0x81bc288, tm=0xbfffe63c) at
../../libggi/ggi/mode.c:143
#3 0x4015d2e7 in ggiSetSimpleMode (vis=0x81bc288, xsize=0, ysize=0, frames=2,
type=0) at ../../libggi/ggi/mode.c:306
#4 0x80f4318 in GGI_init () at ../term/ggi.trm:391
[...]
printing the priv->xwin:
(gdb) p priv->xwin
$2 = {
x = {
display = 0x81bcdf8,
screen = 0,
gc = 0x81c7cc0,
cmap = 27262986,
nocols = 24,
xliblock = 0x81c5068,
inp = 0x81c5130
},
visual = {
visual = 0x81bd3e8,
visualid = 34,
screen = 0,
depth = 16,
class = 4,
red_mask = 63488,
green_mask = 2016,
blue_mask = 31,
colormap_size = 64,
bits_per_rgb = 6
},
window = 27262982,
cursor = 27262981,
wintype = 1,
defsize = {
x = 640,
y = 480
},
cmap_first = 40,
cmap_last = 1310976
}
Note, that the visual is just beeing created, but
cmap_first = 40
cmap_last = 1310976
so I guess this is an initialization problem.
(using libggi of 23.12.2000, but the problems are observable
since at least one month I guess)
Again: all problems only occur, if initializing/exiting more than once !!
--
Johannes
// -*- C++ -*-
// FILE: "/home/joze/tmp/test1.c"
// LAST MODIFICATION: "Die, 26 Dez 2000 18:37:04 +0100 (joze)"
// (C) 2000 by Johannes Zellner, <[EMAIL PROTECTED]>
// vim:set makeprg=gcc\ -Wall\ -I.\ -I/home/joze/include\ -o\ %\:r\ %\
-L/usr/local/lib\ -lggi:
// $Id:$
#include <ggi/ggi.h>
void
runggi(void)
{
ggi_visual_t vis;
ggi_mode mode = {
1,
{GGI_AUTO,GGI_AUTO},
{GGI_AUTO,GGI_AUTO},
{0,0},
GT_AUTO,
{GGI_AUTO,GGI_AUTO}
};
if (ggiInit()) {
ggiPanic("test: unable to initialize LibGGI, exiting.\n");
}
if ((ggi_visual_t)0 == (vis = ggiOpen(NULL))) {
ggiPanic("test: unable to open default visual, exiting.\n");
}
if (ggiSetMode(vis, &mode)) {
ggiPanic("Can't set mode\n");
}
ggiFlush(vis);
fprintf(stderr, "hit any key to finish\n");
ggiGetc(vis);
ggiClose(vis);
ggiExit();
}
int
main(int argc, char **argv)
{
runggi();
runggi();
return 0;
}