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.