【发布时间】:2011-01-03 17:26:24
【问题描述】:
我们有一个相当大的跨平台 C++ 程序在 wxWidgets 上运行。最近一大块代码从 windows 移植到 linux,从那时起程序在弹出对话框的显示时崩溃。打印到控制台的错误信息是:
The program 'program name' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadAlloc (insufficient resources for operation)'.
(Details: serial 12425 error_code 11 request_code 53 minor_code 0)
(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 --sync command line
option to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
libxcb: WARNING! Program tries to lock an already locked connection,
which indicates a programming error.
There will be no further warnings about this issue.
使用调试器单步执行代码,有问题的行似乎是:
wxBitmap* maskBmp = new wxBitmap(iconPath, wxBITMAP_TYPE_BMP);
wxMask* mask = new wxMask(*maskBmp, wxColour(255, 0, 255));
在崩溃的第二行之后。位图似乎可以正确加载,因为在工具栏中的其他地方使用相同的图标没有任何问题。正如错误消息所暗示的那样,我尝试使用“--sync”进行调试,但这似乎没有多大帮助,因为 gdb 似乎无法在 gdk_x_error() 函数上设置断点。
关于错误可能来自哪里,或者至少如何追踪它的任何想法?
谢谢
更新:请注意,我收到了 xWindows 断言错误的日志,例如:
(main:5322): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed
(main:5322): Gdk-CRITICAL **: gdk_drawable_get_image: assertion `GDK_IS_DRAWABLE (drawable)' failed
(main:5322): Gdk-CRITICAL **: gdk_image_get_colormap: assertion `GDK_IS_IMAGE (image)'failed
(main:5322): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed
但这似乎一直在发生,即使程序运行良好!
【问题讨论】:
标签: linux debugging wxwidgets x11