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:


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?
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to