[pygtk] Problem with the GC starting in the middle of _wrap_gtk_window_list_toplevels

Laszlo Pandy laszlok2 at gmail.com
Mon Mar 9 10:47:47 WST 2009


Is the gtk.gdk.lock unnecessary? My understanding is that if you use
timeout_add the callback will happen as an event in the mainloop. ie.
it won't happen spontaneously in the middle of some other code unless
gtk.main_iteration() is explicitly called.

So wouldn't calling gc.collect() from the callback without the lock
server the same purpose, or am I misunderstanding something?

Laszlo

2009/3/8 Tim Evans <t.evans at aranz.com>:
>
> For a rather brute-force hack, you can do this:
>
>   import gtk, gobject
>   import gc
>
>   gc.disable()
>   def collect():
>       with gtk.gdk.lock:
>           gc.collect()
>           return True
>   gobject.timeout_add_seconds(10, collect)
>
> Not a long-term solution, but it gets your software working.
>
> --
> Tim Evans
> Applied Research Associates NZ
> http://www.aranz.com/
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
>


More information about the pygtk mailing list