无法使用 XFreeColors() 释放 Xlib 中的颜色图条目
我使用下一个代码分配一个颜色条目,然后用它来正确绘制:
char *color_name = "red";
XColor color, exact;
XAllocNamedColor(display, colormap, color_name, &color, &exact);
然后,当我不再需要颜色条目时,我尝试释放它:
XFreeColors(display, colormap, &color.pixel, 1, 0);
此调用会生成下一个错误:
Error of failed request: BadAccess (attempt to access private resource denied)
Major opcode of failed request: 88 (X_FreeColors)
Serial number of failed request: 17
Current serial number in output stream: 19
我有什么东西吗?做错了吗? 我怎样才能释放该颜色条目? 该颜色条目应该被释放吗?
I allocate a color entry with the next code, then I use it to draw correctly:
char *color_name = "red";
XColor color, exact;
XAllocNamedColor(display, colormap, color_name, &color, &exact);
Then, when I don't need anymore the color entry, I try to free it:
XFreeColors(display, colormap, &color.pixel, 1, 0);
This call generates the next error:
Error of failed request: BadAccess (attempt to access private resource denied)
Major opcode of failed request: 88 (X_FreeColors)
Serial number of failed request: 17
Current serial number in output stream: 19
Is there something I'm doing wrong? How can I free that color entry? That color entry should be freed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
已解决:我正在对 XFreeColors 进行两次调用:
第二个调用绝对不能完成,这是没有必要的。
Solved: I was doing two call to XFreeColors:
The second call with exact must not be done, it's not necessary.