summaryrefslogtreecommitdiff
path: root/hw/kdrive/ephyr/ephyrhostglx.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/kdrive/ephyr/ephyrhostglx.c')
-rw-r--r--hw/kdrive/ephyr/ephyrhostglx.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/hw/kdrive/ephyr/ephyrhostglx.c b/hw/kdrive/ephyr/ephyrhostglx.c
index 5d9a482e8..f5db5be16 100644
--- a/hw/kdrive/ephyr/ephyrhostglx.c
+++ b/hw/kdrive/ephyr/ephyrhostglx.c
@@ -151,6 +151,7 @@ ephyrHostGLXGetStringFromServer (int a_screen_number,
{
Bool is_ok=FALSE ;
Display *dpy = hostx_get_display () ;
+ int default_screen = DefaultScreen (dpy);
xGLXGenericGetStringReq *req=NULL;
xGLXSingleReply reply;
int length=0, numbytes=0, major_opcode=0, get_string_op=0;
@@ -188,13 +189,17 @@ ephyrHostGLXGetStringFromServer (int a_screen_number,
GetReq (GLXGenericGetString, req);
req->reqType = major_opcode;
req->glxCode = get_string_op;
- req->for_whom = DefaultScreen (dpy);
+ req->for_whom = default_screen;
req->name = a_string_name;
_XReply (dpy, (xReply *)&reply, 0, False);
length = reply.length * 4;
- numbytes = reply.size;
+ if (!length) {
+ numbytes = 0;
+ } else {
+ numbytes = reply.size;
+ }
EPHYR_LOG ("going to get a string of size:%d\n", numbytes) ;
*a_string = (char *) Xmalloc (numbytes +1);