Bug 52431 - XInitThreads causes X printing to hang
Summary: XInitThreads causes X printing to hang
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: XFree86
Version: 7.0
Hardware: i386
OS: Linux
high
high
Target Milestone: ---
Assignee: Mike A. Harris
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-08-23 18:14 UTC by Dave Thomson
Modified: 2005-10-31 22:00 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2001-08-23 18:14:20 UTC
Embargoed:


Attachments (Terms of Use)

Description Dave Thomson 2001-08-23 18:14:16 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)

Description of problem:
On Linux RedHat 7.0 , if you call XInitThreads and link with
pthread, the first Xp call will hang.


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
Here are the steps to reproduce it:

1) Compile the enclosed C code in a machine with XPrinting
installed.

2) Setup a X printing server by running the following as root:

	Xprt :1 &

3) Run the executable "test". It should print out "start" and then hang.

4) Comment the following line in the makefile

LIB_FLAGS += -lpthread

5) Recompile the testcase.

6) Run it again. It should not hang this time.


++++++++++++++++++++++++ makefile ++++++++++++++++++++++++++++++++
LIB_FLAGS = -L/usr/X11R6/lib -lXt -lX11 -lXp -lXext
OBJS = print_hang.o

# Comment this line and the test will not hang
LIB_FLAGS += -lpthread

all: $(OBJS)
	cc -o test $(OBJS) $(LIB_FLAGS)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

++++++++++++++++++++++++ print_hang.c +++++++++++++++++++++++++++++
#include <X11/Intrinsic.h>

#define PRINTER_NAME ":1"

int main(int argc, char **argv) {
  XtAppContext xPrinterContext;
  Display *xPrinter;
  short major, minor;
  
  printf("start\n");
  XInitThreads();
  XtToolkitThreadInitialize();
  XtToolkitInitialize();

  xPrinterContext = XtCreateApplicationContext();
  xPrinter = XtOpenDisplay(xPrinterContext, PRINTER_NAME, NULL, NULL,  
NULL, 0,  &argc, argv);
  if (xPrinter != NULL) {
    XpQueryVersion(xPrinter, &major, &minor);
    printf("XpExtension %d.%d\n", major, minor);
  } else {
    printf("Failed to open printer\n");
  }

  XtDestroyApplicationContext(xPrinterContext);
  printf("end\n");
}
	

Additional info:

Comment 1 Mike A. Harris 2001-08-23 18:21:42 UTC
The Xprint extension is broken, and totally unsupported.


Note You need to log in before you can comment on or make changes to this bug.