Score:0

How to fix the X Window System error coming when running a c++ GTK program

cl flag

I am getting an error while running a program written in c++ in GTK. The program stops when this error appear. I am a beginner and i have no idea what to do for this. The error is as follows.

(main:4082): Gdk-ERROR **: 15:33:56.607: The program 'main' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadLength (poly request too large or internal Xlib length erro'.
  (Details: serial 56298 error_code 16 request_code 139 (RENDER) minor_code 23)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the GDK_SYNCHRONIZE environment
   variable to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)
Trace/breakpoint trap (core dumped)

I have used a function to run asynchronously in the program. I think that this error might be because of that. The function is as follows.

void asyncFunction (){
  while(1){
    counter = counter +1;
    
    //cout << counter<<endl;
    string str = to_string(counter);
    const char * bn = str.c_str();
    gtk_entry_set_text(GTK_ENTRY(Entry_length) , bn);
    sleep(2);
  }
}

And i have added the following line in the main.

future<void> fn = async(launch::async, asyncFunction);

I found this in the internet and i dont have much idea about this.

Can anyone please help me to fix this error. Thank you.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.