diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2004-06-03 13:31:51 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2004-06-03 13:31:51 (GMT) |
commit | 8d562e6b4f80c248e7eee319f02161d4d2b69b4f (patch) | |
tree | 5cfb693383f0f52124938b602d2b3084b8a511b6 /Mac | |
parent | d6d35d954bf4b0738d2d0e50a15441376ab98fe1 (diff) | |
download | cpython-8d562e6b4f80c248e7eee319f02161d4d2b69b4f.zip cpython-8d562e6b4f80c248e7eee319f02161d4d2b69b4f.tar.gz cpython-8d562e6b4f80c248e7eee319f02161d4d2b69b4f.tar.bz2 |
Very large scripts folders could crash the IDE, because it runs out
of Menu IDs (of which there are only 255 in Carbon). Fixed by stopping
examining the scripts folder when we allocate menu ID 200.
Fixes #959291. Need to backport.
Diffstat (limited to 'Mac')
-rw-r--r-- | Mac/Tools/IDE/Wapplication.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Mac/Tools/IDE/Wapplication.py b/Mac/Tools/IDE/Wapplication.py index a63be2a..553391e 100644 --- a/Mac/Tools/IDE/Wapplication.py +++ b/Mac/Tools/IDE/Wapplication.py @@ -275,17 +275,21 @@ class Application(FrameWork.Application): self.makeusermenus() def scriptswalk(self, top, menu, done=None): + if menu.id > 200: + import W + W.Message("Scripts folder not completely traversed: running out of menus") + return False if done is None: done = {} if done.has_key(top): - return + return True done[top] = 1 import os, string try: names = os.listdir(top) except os.error: FrameWork.MenuItem(menu, '(Scripts Folder not found)', None, None) - return + return True savedir = os.getcwd() os.chdir(top) for name in names: @@ -306,7 +310,8 @@ class Application(FrameWork.Application): menu.addseparator() elif isdir: submenu = FrameWork.SubMenu(menu, name) - self.scriptswalk(path, submenu, done) + if not self.scriptswalk(path, submenu, done): + return False else: creator, type = MacOS.GetCreatorAndType(path) if type == 'TEXT': @@ -316,6 +321,7 @@ class Application(FrameWork.Application): self._scripts[(menu.id, item.item)] = path done[path] = 1 os.chdir(savedir) + return True def domenu_script(self, id, item, window, event): (what, message, when, where, modifiers) = event |