[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xwt-patches
Subject:    [patches] proposed patch to HEAD: check for moving a redirec target
From:       david () xwt ! org
Date:       2003-04-24 14:17:33
[Download RAW message or body]

Check the parents of a moving box to make sure it is not the target of a redirect.

This is a fix for the problem Charlie pointed out in the recent thread: [core] \
Interesting redirect question

Index: src/org/xwt/Box.java
===================================================================
RCS file: /cvs/xwt/src/org/xwt/Box.java,v
retrieving revision 1.24
diff -u -r1.24 Box.java
--- src/org/xwt/Box.java	10 Apr 2003 00:41:43 -0000	1.24
+++ src/org/xwt/Box.java	24 Apr 2003 14:04:35 -0000
@@ -1091,6 +1091,16 @@
 
         } else {
             Box newnode = (Box)value;
+
+            // check if box being moved is currently target of a redirect
+            for(Box cur = newnode.getParent(); cur != null; cur = cur.getParent())
+                if (cur.redirect == newnode) {
+                    if (Log.on) Log.log(this, "attempt to move a box that is the \
target of a redirect at "+ +                                        \
Context.enter().interpreterSourceFile + ":" + Context.enter().interpreterLine); +     \
return; +                }
+
+            // check for recursive ancestor violation
             for(Box cur = this; cur != null; cur = cur.getParent())
                 if (cur == newnode) {
                     if (Log.on) Log.log(this, "attempt to make a node a parent of \
its own ancestor at " + 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic