Hi,
Riccardo Mottola wrote:
The patch seems to work with one or more operations on both gcc
computers.
However on NetBSD with clang, on copy I get a hang even with at the
first copy operation! Why? nothing meaningful should change. Is my new
code buggy? Or does it trigger some runtime bug?
I rewrote a simpler version of the patch: it is esentially the original
code "fixed" not to give an array-bounds-exception.
I think that both versions however should return NSZeroRect in case
there are no other file operations in queue! This second patch doesn't
hang with clang/libobjc2
(However it does also work worse: sometimes the next operation window
overlaps with the previous and doesn't get the right offset, very strange).
Happy Christmas!
Riccardo
Index: Operation/Operation.m
===================================================================
--- Operation/Operation.m (revision 38260)
+++ Operation/Operation.m (working copy)
@@ -366,33 +366,40 @@
#define WMARGIN 50
#define WSHIFT 50
+ if ([fileOperations count] == 0)
+ return wrect;
+
scr.origin.x += WMARGIN;
scr.origin.y += WMARGIN;
scr.size.width -= (WMARGIN * 2);
scr.size.height -= (WMARGIN * 2);
- for (i = [fileOperations count]; i > 0; i--) {
- FileOpInfo *op = [fileOperations objectAtIndex: i];
+ for (i = [fileOperations count]; i > 0; i--)
+ {
+ FileOpInfo *op = [fileOperations objectAtIndex: i-1];
- if ([op win]) {
- NSRect wr = [op winRect];
-
- if (NSEqualRects(wr, NSZeroRect) == NO) {
- wrect = NSMakeRect(wr.origin.x + WSHIFT,
- wr.origin.y - wr.size.height - WSHIFT,
- wr.size.width,
- wr.size.height);
-
- if (NSContainsRect(scr, wrect) == NO) {
- wrect = NSMakeRect(scr.origin.x,
- scr.size.height - wr.size.height,
- wr.size.width,
- wr.size.height);
- break;
+ if ([op win])
+ {
+ NSRect wr = [op winRect];
+
+ if (NSEqualRects(wr, NSZeroRect) == NO)
+ {
+ wrect = NSMakeRect(wr.origin.x + WSHIFT,
+ wr.origin.y - wr.size.height - WSHIFT,
+ wr.size.width,
+ wr.size.height);
+
+ if (NSContainsRect(scr, wrect) == NO)
+ {
+ wrect = NSMakeRect(scr.origin.x,
+ scr.size.height - wr.size.height,
+ wr.size.width,
+ wr.size.height);
+ break;
+ }
+ }
}
- }
}
- }
return wrect;
}
_______________________________________________
Discuss-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep