diff options
author | Ton Roosendaal <ton@blender.org> | 2006-12-26 12:19:19 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-12-26 12:19:19 +0300 |
commit | e4511c805fa3cdebb33f321963fcdb46cc0c4aea (patch) | |
tree | 0b333f16b3349a0c920257c9adbfa5c9f55f22c2 /source/blender/src/mywindow.c | |
parent | 10137426a6b88ac29834e87d0bb359ff677904ee (diff) |
Ancient bug: when subdividing the screen many times, it gives a crash when
the amount of subwindows reaches 128 (64 areas+headers).
Added a warning instead of crash!
Diffstat (limited to 'source/blender/src/mywindow.c')
-rw-r--r-- | source/blender/src/mywindow.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/source/blender/src/mywindow.c b/source/blender/src/mywindow.c index f211558bacf..c30fc910fc6 100644 --- a/source/blender/src/mywindow.c +++ b/source/blender/src/mywindow.c @@ -377,11 +377,13 @@ int myswinopen(int parentid, int xmin, int xmax, int ymin, int ymax) if (!swinarray[freewinid]) break; + /* this case is not handled in Blender, so will crash. use myswinopen_allowed() first to check */ if (freewinid==MAXWIN) { printf("too many windows\n"); return 0; - } else { + } + else { win= MEM_callocN(sizeof(*win), "winopen"); win->id= freewinid; @@ -403,6 +405,19 @@ int myswinopen(int parentid, int xmin, int xmax, int ymin, int ymax) } } +int myswinopen_allowed(void) +{ + int totfree=0; + int freewinid; + + for (freewinid= 4; freewinid<MAXWIN; freewinid++) + if (swinarray[freewinid]==NULL) + totfree++; + if(totfree<2) + return 0; + return 1; +} + void mywinclose(int winid) { if (winid<4) { |