Public bug reported:

Here is a Python script, using pygtk, which demonstrates the problem.

from gtk import main, main_quit
from gobject import threads_init, timeout_add, source_remove
import sys

def test(iterations, use_threads):
    if use_threads:
        threads_init()
    tick = 0
    while tick < iterations:
        tick += 1
        if (tick % 1000) == 0:
            print 'Tick', tick
        lasttag = timeout_add(1, main_quit)
        main()
        source_remove(lasttag)

if __name__ == "__main__":
    if sys.argv[1:] == ['no-threads']:
        threads = False
    else:
        threads = True
    print 'Using threads:', threads
    test(10000, threads)
    print 'Done.'

When run on Jaunty or Intrepid, this is the output:

$ python gtkrash.py 
Using threads: True

** ERROR **: Cannot create main loop pipe: Too many open files

aborting...
Aborted
$ python gtkrash.py no-threads
Using threads: False
Tick 1000
Tick 2000
Tick 3000
Tick 4000
Tick 5000
Tick 6000
Tick 7000
Tick 8000
Tick 9000
Tick 10000
Done.
$ 

When run on Hardy, however, the test is successful regardless of whether
threads are used.

** Affects: gtk+2.0 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
gtk_main leaks a file descriptor every time the main loop is run if threads 
have been initialized
https://bugs.launchpad.net/bugs/363245
You received this bug notification because you are a member of Ubuntu
Desktop Bugs, which is subscribed to gtk+2.0 in ubuntu.

-- 
desktop-bugs mailing list
desktop-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/desktop-bugs

Reply via email to