Segfaults

Sorry to be a pest again but I’m having a problem. I have been messing
around with ttflib, and it compiles OK but I am getting segfaults every
time I try to run the code.

If someone could tell me what to fix and more importantly what I am
doing wrong it would be greatly appreciated. I have spun my wheels for
3 hours now and gotten nowhere…

Michael Fletcher

---- cut
bash-2.01$ ./lsim
lsim: graphics: ttf: initOK
lsim: graphics: initOK - changing vmode…
You must be root to set a fullscreen mode
lsim: graphics: vmodeOK
lsim: graphics: gw: render…
lsim: graphics: gw: renderOK
lsim: graphics: gw: map…
Fatal signal: Segmentation Fault (SDL Parachute Deployed)
SDL Warning: 1 SDL surfaces extant
---- cut

---- cut
SDL_Surface *screen;
SDL_Surface *buffer;
TTF_Font *font;

void graph_write(char message[128], int x, int y, SDL_Color fg,
SDL_Color bg) {
SDL_Surface *text;

fprintf(stderr, “lsim: graphics: gw: render…\n”);
text = TTF_RenderText(font, message, fg, bg);
if (text = NULL) {
fprintf(stderr, “lsim: graphics: TTF: couldn’t render text\n”);
}
fprintf(stderr, “lsim: graphics: gw: renderOK\n”);

fprintf(stderr, “lsim: graphics: gw: map…\n”);
if (SDL_MapSurface(*text, screen->format) != 0) {
fprintf(stderr, “lsim: graphics: TTF: couldn’t map text\n”);
}
fprintf(stderr, “lsim: graphics: gw: mapOK\n”);
// why?

fprintf(stderr, “lsim: graphics: gw: blit…\n”);
SDL_BlitSurface(text, NULL, screen, NULL);
fprintf(stderr, “lsim: graphics: gw: blitOK\n”);

SDL_FreeSurface(text);
fprintf(stderr, “lsim: graphics: gwOK\n”);
}
---- cut

Grab SDL-0.9 (devel) and take out the SDL_MapSurface() call.On Sun, Oct 04, 1998 at 12:18:51PM -0600, Michael Fletcher wrote:

Sorry to be a pest again but I’m having a problem. I have been messing
around with ttflib, and it compiles OK but I am getting segfaults every
time I try to run the code.

If someone could tell me what to fix and more importantly what I am
doing wrong it would be greatly appreciated. I have spun my wheels for
3 hours now and gotten nowhere…

if (SDL_MapSurface(*text, screen->format) != 0) {
fprintf(stderr, “lsim: graphics: TTF: couldn’t map text\n”);
}
fprintf(stderr, “lsim: graphics: gw: mapOK\n”);


– Michael Samuel

michael at surfnetcity.com.au wrote:> On Sun, Oct 04, 1998 at 12:18:51PM -0600, Michael Fletcher wrote:

Sorry to be a pest again but I’m having a problem. I have been messing
around with ttflib, and it compiles OK but I am getting segfaults every
time I try to run the code.

If someone could tell me what to fix and more importantly what I am
doing wrong it would be greatly appreciated. I have spun my wheels for
3 hours now and gotten nowhere…

if (SDL_MapSurface(*text, screen->format) != 0) {
fprintf(stderr, “lsim: graphics: TTF: couldn’t map text\n”);
}
fprintf(stderr, “lsim: graphics: gw: mapOK\n”);

Grab SDL-0.9 (devel) and take out the SDL_MapSurface() call.

Does SDL have keyboard repeat in 0.9? I’m just curious…

Thanks,

Paul Lowe
xpaull at ultraviolet.org

Does SDL have keyboard repeat in 0.9? I’m just curious…

Nope, it’s the same as usual, except, if you don’t want X11 keyboard
repeat turned off, you can define IGNORE_X_KEYREPEAT, and SDL won’t touch
the keyrepeat.

See ya!
-Sam Lantinga (slouken at devolution.com)–
Author of Simple DirectMedia Layer -
http://www.devolution.com/~slouken/SDL/