Sometimes, the pending events can get into an infinite loop of causing more events to be handled; this fix makes it finite

svn: r13778
This commit is contained in:
Doug Blank
2009-12-12 17:01:06 +00:00
parent b1254d7820
commit 58dc389e48
2 changed files with 17 additions and 9 deletions

View File

@@ -271,3 +271,15 @@ def open_file_with_default_application( file_path ):
if os.path.isfile(prog):
os.spawnvpe(os.P_NOWAIT, prog, [prog, norm_path], os.environ)
return
def process_pending_events(max_count=10):
"""
Process pending events, but don't get into an infinite loop.
"""
import gtk
count = 0
while gtk.events_pending():
gtk.main_iteration()
count += 1
if count >= max_count:
break