我在 GTK 中运行用 c++ 编写的程序时遇到错误。出现此错误时程序停止。我是初学者,我不知道该怎么做。错误如下。
(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)
我在程序中使用了一个异步运行的函数。我认为这个错误可能是因为这个。该函数如下。
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);
}
}
并且我在主文件中添加了以下行。
future<void> fn = async(launch::async, asyncFunction);
我在网上发现了这一点,但我对此并不太了解。
有人能帮我修复这个错误吗?谢谢。
答案1
该错误很可能与您的程序代码的任何行为无关,而是由输入数据和/或某些字体配置引起的。
在包含“