From 094e2f1a67b522cc9e8d20add86d31b055e4a9e6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 13 Aug 2000 03:44:08 +0000 Subject: fixed segfault problem when using MESA_GLX_FX --- src/mesa/drivers/x11/xfonts.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/x11/xfonts.c b/src/mesa/drivers/x11/xfonts.c index 0daaa9443f..2dcd2690a0 100644 --- a/src/mesa/drivers/x11/xfonts.c +++ b/src/mesa/drivers/x11/xfonts.c @@ -1,4 +1,4 @@ -/* $Id: xfonts.c,v 1.6 2000/04/19 01:44:02 brianp Exp $ */ +/* $Id: xfonts.c,v 1.7 2000/08/13 03:44:08 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -231,26 +231,23 @@ void Fake_glXUseXFont( Font font, int first, int count, int listbase ) XGCValues values; unsigned long valuemask; XFontStruct *fs; - GLint swapbytes, lsbfirst, rowlength; GLint skiprows, skippixels, alignment; - unsigned int max_width, max_height, max_bm_width, max_bm_height; GLubyte *bm; - int i; - CC = XMesaGetCurrentContext(); - dpy = CC->display; - win = CC->xm_buffer->frontbuffer; + dpy = glXGetCurrentDisplay(); + if (!dpy) + return; /* I guess glXMakeCurrent wasn't called */ + win = RootWindow(dpy, DefaultScreen(dpy)); fs = XQueryFont (dpy, font); - if (!fs) - { + if (!fs) { gl_error (CC->gl_ctx, GL_INVALID_VALUE, "Couldn't get font structure information"); return; - } + } /* Allocate a bitmap that can fit all characters. */ max_width = fs->max_bounds.rbearing - fs->min_bounds.lbearing; @@ -265,7 +262,7 @@ void Fake_glXUseXFont( Font font, int first, int count, int listbase ) gl_error (CC->gl_ctx, GL_OUT_OF_MEMORY, "Couldn't allocate bitmap in glXUseXFont()"); return; - } + } #if 0 /* get the page info */ -- cgit v1.2.3