[Libreoffice] Reusing the GLib mainloop from GTK/GNOME integration

Michael Meeks michael.meeks at novell.com
Tue Feb 8 13:17:40 PST 2011

Hi Alberto,

On Tue, 2011-02-08 at 17:47 +0000, Alberto Ruiz wrote:
> I am working on exporting the menubar menu items structure through a
> DBus service, you can check my progress this the bzr branch I am
> working on[0].

	Wonderful :-) but why are you doing this as an extension ? :-) surely
we should put this into the core code ? it should be rather easier to do
that, and less problematic.

> My approach is creating a Synchronous Job that gets executed everytime
> a document is opened[1][2].

	Hokay, no idea if that makes sense without reading the framework code
personally ;-)

> On the execute method of my job, if I call g_idle_add with a simple
> function doing just a multiply operation before return, I get
> rendering problems, arbitrary elements of the UI ...

	Sooo ... we have gtk mainloop integration; but you need to get the
locking right of course; if it is pure gtk code; you should use:


	as you hit your idle handler, and GDK_THREADS_LEAVE as you exit it.
Hmm ! interestingly I get similar corruption opening the file-selector
over the top of the shell - which might be related - fun. That would be
my first port of call.

> My question is, is there a safe manner or any recommended practice
> while using the glib mainloop from OpenOffice if the GNOME/GTK
> integration is in use?

	cf. above I guess. I didn't see any interesting code at the links you
posted though so ... beyond taking the toolkit lock before using the
toolkit, I am not sure :-) There are really two ways to do that - one is
with the GDK_THREADS magic; the other is via
vcl/inc/vcl/solarmutex.hxx's helper.



 michael.meeks at novell.com  <><, Pseudo Engineer, itinerant idiot

More information about the LibreOffice mailing list