Search code examples
pluginsfirebreath

InvalidateWindow() stops working


i am writing a plugin with content to display, collected code from all examples i found on the internet, i run PluginWindowX11 on Firefox and everything works as expected, except the plugin stops redrawing after 1-5 minutes of work,

what i do is:

  1. set 40ms timer, i wait for this to refresh the display

    m_timer = FB::Timer::getTimer(40, true, boost::bind(&PluginWindowX11::update, this)); m_timer->start()

  2. in the callback i ask the browser for expose event

    void PluginWindowX11::update() { InvalidateWindow(); return; }

  3. in gboolean PluginWindowX11::EventCallback(GtkWidget *widget, GdkEvent *event) for the GDK_EXPOSE event i redraw the window

switch(event->type)
{
case GDK_EXPOSE:
{
GdkEventExpose * exposeEvent = reinterpret_cast(event);
FB::Rect rect;
rect.left = exposeEvent->area.x;
rect.top = exposeEvent->area.y;
rect.right = exposeEvent->area.x + exposeEvent->area.width;
rect.bottom = exposeEvent->area.y + exposeEvent->area.height;
FBLOG_INFO("EXPOSE", string_format("got expose m_canvas = %X rect: ", m_canvas) << rect_format(rect));
redrawdraw();
RefreshEvent evt(rect);
return SendEvent(&evt) ? 1 : 0;
}
}

i redraw the whole window, no matter what part of it is exposed, i just print it for reference

i have seen it working 10 minutes, usualy after a minute the plugin stops redrawing itself. i have verified that the timer is running, i calls InvalidateWindow() but there is no more GDK_EXPOSE events, not a single one, everything else is working its printing debug and responding to mouse events, it just wont get new expose event, i cannot be 100% sure but i did not get WindowDetached events

anyone else experiencing this ?

system is 64bit Ubuntu 12.04 Xfce , testing it on firefox 29.0

thanks in advance


Solution

  • thanks to Kalo who pointed me this

    https://groups.google.com/forum/#!topic/firebreath-dev/qlxpThEUHH0

    problem fixed when i added all the gdk_thread_init/enter/leave calls