harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r536867 - in /harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux: LinuxEvent.java LinuxWindow.java
Date Thu, 10 May 2007 13:53:38 GMT
Author: apetrenko
Date: Thu May 10 06:53:37 2007
New Revision: 536867

URL: http://svn.apache.org/viewvc?view=rev&rev=536867
Log:
Patch for HARMONY-3541 "[classlib][awt] Some tests crash VM on Linux"

Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/LinuxEvent.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/LinuxWindow.java

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/LinuxEvent.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/LinuxEvent.java?view=diff&rev=536867&r1=536866&r2=536867
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/LinuxEvent.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/LinuxEvent.java
Thu May 10 06:53:37 2007
@@ -282,6 +282,10 @@
 
     private void processMotionEvent(X11.XMotionEvent event) {
         LinuxWindow win = (LinuxWindow) factory.getWindowById(windowId);
+        
+        if (win == null) {
+            return;
+        }
 
         localPos = new Point(event.get_x(), event.get_y());
         if (!localPos.equals(win.queryPointer())) {
@@ -357,6 +361,11 @@
 
     private void processConfigureEvent(X11.XConfigureEvent event) {
         LinuxWindow win = (LinuxWindow)factory.getWindowById(windowId);
+        
+        if (win == null) {
+            return;
+        }
+        
         boolean child = win.isChild();
         boolean isSynthetic = event.get_send_event() != 0;
 
@@ -441,9 +450,11 @@
      */
     private void processInsetsChange(Insets newInsets) {
         LinuxWindow win = (LinuxWindow) factory.getWindowById(windowId);
+        
         if ((win == null) || win.isChild() || win.isUndecorated()) {
             return;
         }
+        
         eventId = ID_INSETS_CHANGED;
 
         if (newInsets != null) {
@@ -482,6 +493,11 @@
 
     private void deriveNewWindowState(int typesCount, CLongPointer types) {
         LinuxWindow win = (LinuxWindow) factory.getWindowById(windowId);
+
+        if (win == null) {
+            return;
+        }
+        
         int oldState = win.getState();
         int newState = 0;
         boolean oldAlwaysOnTop = win.alwaysOnTop;
@@ -610,17 +626,20 @@
     }
 
     private long getContentId(long winId) {
-        if (factory.validWindowId(winId)) {
-            LinuxWindow win = (LinuxWindow) factory
-                    .getWindowById(winId);
+        LinuxWindow win = (LinuxWindow) factory.getWindowById(winId);
+        
+        if (win != null) {
             LinuxWindow content = win.getContentWindow();
+            
             if (content != null) {
                 long contentId = content.getId();
+                
                 if (factory.validWindowId(contentId)) {
                     return contentId;
                 }
             }
         }
+        
         return winId;
     }
 

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/LinuxWindow.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/LinuxWindow.java?view=diff&rev=536867&r1=536866&r2=536867
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/LinuxWindow.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/wtk/linux/LinuxWindow.java
Thu May 10 06:53:37 2007
@@ -636,12 +636,17 @@
         PointerPointer children = bridge.createPointerPointer(1, true);
         Int32Pointer count = bridge.createInt32Pointer(1, false);
 
-        x11.XQueryTree(display, windowID, root, parent, children, count);
-        VoidPointer data = children.get(0);
-        if (data != null) {
-            x11.XFree(data);
+        if (x11.XQueryTree(display, windowID, root, parent, children, count) != 0) {
+            final VoidPointer data = children.get(0);
+            
+            if (data != null) {
+                x11.XFree(data);
+            }
+            
+            return parent.get(0);
         }
-        return parent.get(0);
+        
+        return 0;
     }
 
     private long getFrameID(long windowId, long rootID) {



Mime
View raw message