PDA

View Full Version : Client/Server Error: BadIDChoice



3nc31
27th November 2007, 01:25
Hi!!!

I have a problem with my client/server application :( (C, C++ and Qt). When I compile it, this is the error:

X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Major opcode: 1 (X_CreateWindow)
Resource id: 0x36001fe
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Extension: 153 (RENDER)
Minor opcode: 4 (RenderCreatePicture)
Resource id: 0x36001ff
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Major opcode: 1 (X_CreateWindow)
Resource id: 0x3600200
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Extension: 153 (RENDER)
Minor opcode: 4 (RenderCreatePicture)
Resource id: 0x3600201
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Major opcode: 1 (X_CreateWindow)
Resource id: 0x3600202
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Extension: 153 (RENDER)
Minor opcode: 4 (RenderCreatePicture)
Resource id: 0x3600203
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Major opcode: 1 (X_CreateWindow)
Resource id: 0x3600204
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Extension: 153 (RENDER)
Minor opcode: 4 (RenderCreatePicture)
Resource id: 0x3600205
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Major opcode: 1 (X_CreateWindow)
Resource id: 0x3600206
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Extension: 153 (RENDER)
Minor opcode: 4 (RenderCreatePicture)
Resource id: 0x3600207
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Major opcode: 1 (X_CreateWindow)
Resource id: 0x3600208
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Extension: 153 (RENDER)
Minor opcode: 4 (RenderCreatePicture)
Resource id: 0x3600209
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Major opcode: 1 (X_CreateWindow)
Resource id: 0x360020a
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Extension: 153 (RENDER)
Minor opcode: 4 (RenderCreatePicture)
Resource id: 0x360020b
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Major opcode: 1 (X_CreateWindow)
Resource id: 0x3600212
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Major opcode: 1 (X_CreateWindow)
Resource id: 0x3600214
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Extension: 153 (RENDER)
Minor opcode: 4 (RenderCreatePicture)
Resource id: 0x3600215
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Major opcode: 1 (X_CreateWindow)
Resource id: 0x3600216
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Extension: 153 (RENDER)
Minor opcode: 4 (RenderCreatePicture)
Resource id: 0x3600217
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Major opcode: 1 (X_CreateWindow)
Resource id: 0x3600218
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Extension: 153 (RENDER)
Minor opcode: 4 (RenderCreatePicture)
Resource id: 0x3600219
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Major opcode: 1 (X_CreateWindow)
Resource id: 0x360021a
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Extension: 153 (RENDER)
Minor opcode: 4 (RenderCreatePicture)
Resource id: 0x360021b
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Major opcode: 1 (X_CreateWindow)
Resource id: 0x360021c
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Extension: 153 (RENDER)
Minor opcode: 4 (RenderCreatePicture)
Resource id: 0x360021d
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Major opcode: 1 (X_CreateWindow)
Resource id: 0x360021e
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Extension: 153 (RENDER)
Minor opcode: 4 (RenderCreatePicture)
Resource id: 0x360021f
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Major opcode: 1 (X_CreateWindow)
Resource id: 0x3600220
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Extension: 153 (RENDER)
Minor opcode: 4 (RenderCreatePicture)
Resource id: 0x3600221
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Major opcode: 1 (X_CreateWindow)
Resource id: 0x3600224
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Extension: 153 (RENDER)
Minor opcode: 4 (RenderCreatePicture)
Resource id: 0x3600225
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Major opcode: 1 (X_CreateWindow)
Resource id: 0x3600226
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Extension: 153 (RENDER)
Minor opcode: 4 (RenderCreatePicture)
Resource id: 0x3600227
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Major opcode: 1 (X_CreateWindow)
Resource id: 0x3600228
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Extension: 153 (RENDER)
Minor opcode: 4 (RenderCreatePicture)
Resource id: 0x3600229
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Major opcode: 1 (X_CreateWindow)
Resource id: 0x360022a
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Extension: 153 (RENDER)
Minor opcode: 4 (RenderCreatePicture)
Resource id: 0x360022b
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Major opcode: 1 (X_CreateWindow)
Resource id: 0x360022c
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Major opcode: 1 (X_CreateWindow)
Resource id: 0x360022e
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Extension: 153 (RENDER)
Minor opcode: 4 (RenderCreatePicture)
Resource id: 0x360022f
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Major opcode: 1 (X_CreateWindow)
Resource id: 0x3600230
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Extension: 153 (RENDER)
Minor opcode: 4 (RenderCreatePicture)
Resource id: 0x3600231
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Major opcode: 1 (X_CreateWindow)
Resource id: 0x3600232
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Extension: 153 (RENDER)
Minor opcode: 4 (RenderCreatePicture)
Resource id: 0x3600233
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Extension: 153 (RENDER)
Minor opcode: 4 (RenderCreatePicture)
Resource id: 0x3600235
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Major opcode: 1 (X_CreateWindow)
Resource id: 0x3600236
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Extension: 153 (RENDER)
Minor opcode: 4 (RenderCreatePicture)
Resource id: 0x3600237
Xlib: unexpected async reply (sequence 0x266b)!
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Major opcode: 1 (X_CreateWindow)
Resource id: 0x3600222
Xlib: sequence lost (0x116ea > 0x16ea) in reply type 0x0!
X Error: BadImplementation (server does not implement operation) 17
Major opcode: 20 (X_GetProperty)
Resource id: 0x0
X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
Major opcode: 53 (X_CreatePixmap)
Resource id: 0x3600238


This is the code that generates the error:


//principal.cpp
#include client.h
...
...
void principal:: startProcess(){
int pid= fork();


if (pid<0){
printf("fork fail");
exit(1);
}

if(pid==0){ // Child
int portConnect;
char name[32];
int portWait = 30000;

waitForChat(portWait, name, &portConnect); //When waitForChat finish, means that other client request for Chat, so the application must show the new window chat.
windowChat = new Chat;
windowChat -> show();
}
}

//client.c
...
...
void waitForChat(int PtWait,char *c, int *PtConnect){

int skt;
int bnd;
int lsn;

int client;
struct sockaddr_in dirclient;
struct sockaddr_in dirserv;
char buffer[1024];



if ((skt = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
perror("Clientv:waitForchat: socket");
exit(1);
}

dirserv.sin_family = AF_INET;
dirserv.sin_port =htons(PtWait);
dirserv.sin_addr.s_addr =INADDR_ANY;


if ((bnd= bind(skt, (struct sockaddr *)&dirserv, sizeof(dirserv) )) < 0) {
perror("Clientv:waitForchat:: bind");
exit(1);
}


if ( (lsn=listen(skt, 100)) < 0) {
perror("Clientv:waitForchat:: listen");
exit(1);
}

if ((client = accept(skt,NULL,0)) < 0){
perror("Clientv:waitForchat: accept");
exit(1);
}



if (recv(client,buffer,1024,0) < 0){
perror("Clientv:waitForchat: recv");
exit(1);

}

sscanf(buffer,"%d %s",PtConnect,c);


close(client);

}
What's the meaning of Error: BadIDChoice .....???
How can I fix it???

Thanks!!! :o

wysota
27th November 2007, 02:47
Where is Qt in that? All I see is C code wrapped into a class. It shouldn't cause any pixmap errors. The problem has to be elsewhere.

3nc31
27th November 2007, 03:23
Most Qt code is in the rest of the file....but I don't have any problems with the rest, I have problems when I want to show a new window on startProcess():


waitForChat(portWait, name, &portConnect); //When waitForChat finish,
// means that other client request for Chat,
// so the application must show the new window chat.
windowChat = new Chat;
windowChat -> show();

If I commented out this part of the code, the compile error doesn't occur, but I need show a new window...so...:confused:

wysota
27th November 2007, 04:14
First, these are not compile errors - they are X server runtime warnings that come from incorrect manipulation of X server resources (like widgets).

The problems you experience are caused by the other part of the code even if they are revealed only when you use the code you posted. My very very long shot is that you try to manipulate widgets from within a worker thread, but without seeing the code, I can't say more.

BTW. Using fork() in Qt apps is not a very good idea - it's probably what causes you problems.

3nc31
27th November 2007, 04:34
First, Thanks for try to help me :)....well, the rest of the code are 8 files (chat.h, chat.cpp, principal.h, principal.cpp, window.h, window.cpp, client.h, client.c) :eek: that is the reason for I doesn't post it!...Do I post it?? :confused: I think is too much for check!!

wysota
27th November 2007, 11:22
No, get rid of those fork() calls. Why do you want to start a separate process for each connection? And why don't you just use Qt networking capabilities instead of using the blocking low-level BSD socket interface? Currently you are doing everything wrong here :)