【发布时间】:2022-01-05 17:12:35
【问题描述】:
我正在尝试在 X11、XLib 应用程序的 C++ 类中进行编程,但在执行以下行时不断收到“程序收到信号 SIGSEGV 分段错误”。 进一步执行 stop n 程序崩溃!
void
sysInfo::Create_Window (Display *dpy, int border_width)
{
scrn = DefaultScreen (dpy); // **ERROR hit on this line**
win_width = DisplayWidth (dpy, scrn);
win_height = DisplayHeight (dpy, scrn);
wmDeleteMsg = XInternAtom (dpy, "WM_DELETE_WINDOW", False);
/* Set up for window Manager Icon */
win_icon = XInternAtom (dpy, "_NET_WM_ICON", False);
cardinal = XInternAtom (dpy, "CARDINAL", False);
/* create operque window */
win = XCreateSimpleWindow (dpy,
RootWindow (dpy, scrn),
0, 0,
win_width,
win_height,
border_width,
BlackPixel (dpy, scrn),
WhitePixel (dpy, scrn) );
//wmHints (); // Window Manager Hints
//sizeHints (); // Window default size could be override
//classHints (); // Window class
// set up exit proc for sudden exit
XSetWMProtocols (dpy, win, &wmDeleteMsg, 1);
【问题讨论】:
-
是的,当然可以。请创建minimal reproducible example 以帮助人们诊断您的错误。
-
可以演示吗?