On 23/05/11 08:34, Tom wrote:
> I am writing a plugin for a system that supplies an X11 window ID and expects
> the plugin to render its UI inside that. I want to, therefore, use
> CreatedWindow such that I am able to use FLTK in it. The following is a
> testcase that blows up in my face just like the real thing:
>
>
Hi Tom,
First of all, a quick suggestion: fltk.development is more intended for
the development of fltk itself, rather than development *with* fltk.
You'd be better off posting in fltk.general, in the hope that more users
respond. I've moved this thread to fltk.general and Bcc'd
fltk.development, in any case. :)
On to your problem:
> bash-3.1$ cat test110.cpp
> #include<fltk/Window.h>
> #include<fltk/run.h>
> #include<fltk/x11.h>
> #include<X11/Xlib.h>
> #include<unistd.h>
>
> int main(int argc, char* argv[]) {
> Display* dis = XOpenDisplay(NULL);
> XWindow win = XCreateSimpleWindow(dis, RootWindow(dis, 0), 1, 1,
> 500, 500, 0, BlackPixel (dis, 0), BlackPixel(dis, 0));
> XMapWindow(dis, win);
> XFlush(dis);
> fltk::Window x(500,500);
> fltk::CreatedWindow::set_xid(&x, win);
> x.show(argc, argv);
> fltk::run();
> return 0;
> }
> bash-3.1$
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0xb7a118f0 (LWP 4706)]
> 0xb7b7e107 in XChangeProperty () from /usr/lib/libX11.so.6
> (gdb) bt
> #0 0xb7b7e107 in XChangeProperty () from /usr/lib/libX11.so.6
> #1 0xb7f79389 in fltk::Window::label () from /usr/lib/libfltk2.so
> #2 0xb7fa158b in fltk::Window::label () from /usr/lib/libfltk2.so
> #3 0xb7f32767 in fltk::Window::show () from /usr/lib/libfltk2.so
> #4 0x08048877 in main (argc=1, argv=0xbfd74fb4) at test110.cpp:14
> (gdb)
>
> So how do I do this properly and what am I doing wrong?
I'm not certain yet whether it's something you're doing wrong or
something FLTK is doing wrong, but when XChangeProperty() is called from
inside src/x11/run.cxx (or if you rejig your code a little, you can
force it to call XMapRaised), it's being called with xdisplay (FLTK's
internal Display*) as a NULL pointer, which I'd be guessing is what
causes the segfault. I'll investigate this a little more when I get back
home (probably a few hours time), but for now hopefully this gets the
ball rolling.
Regards,
Ben
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev