jdk/src/solaris/classes/sun/awt/X11/XQueryTree.java
author darcy
Thu, 13 Mar 2014 12:40:27 -0700
changeset 23647 41d22f2dbeb5
parent 17679 a81555868357
permissions -rw-r--r--
8033712: Fix more serial lint warnings in sun.awt Reviewed-by: alanb, serb, prr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
17679
a81555868357 8005607: Recursion in J2DXErrHandler() Causes a Stack Overflow on Linux
alitvinov
parents: 5506
diff changeset
     2
 * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4214
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4214
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4214
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4214
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4214
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
// This file is an automatically generated file, please do not edit this file, modify the WrapperGenerator.java file instead !
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
package sun.awt.X11;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import sun.misc.Unsafe;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
public class XQueryTree {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
        private static Unsafe unsafe = XlibWrapper.unsafe;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
        private boolean __executed = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
        long _w;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
        long root_ptr = unsafe.allocateMemory(Native.getLongSize());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
        long parent_ptr = unsafe.allocateMemory(Native.getLongSize());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
        long children_ptr = unsafe.allocateMemory(Native.getLongSize());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
        long nchildren_ptr = unsafe.allocateMemory(Native.getIntSize());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
    UnsafeXDisposerRecord disposer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
        public XQueryTree(
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
                long w  )
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
                set_w(w);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
                sun.java2d.Disposer.addRecord(this, disposer = new UnsafeXDisposerRecord("XQueryTree",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
                                                                                         new long[]{root_ptr, parent_ptr, nchildren_ptr},
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
                                                                                         new long[] {children_ptr}));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
                set_children(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
        public int execute() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
                return execute(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
        }
2802
d05a9dcc8296 6678385: Random java.lang.StackOverflowError from various JDKs
art
parents: 2
diff changeset
    53
        public int execute(XErrorHandler errorHandler) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
                XToolkit.awtLock();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
                    if (isDisposed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
                        throw new IllegalStateException("Disposed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
                        if (__executed) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
                            throw new IllegalStateException("Already executed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
                        __executed = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
                        if (errorHandler != null) {
17679
a81555868357 8005607: Recursion in J2DXErrHandler() Causes a Stack Overflow on Linux
alitvinov
parents: 5506
diff changeset
    64
                            XErrorHandlerUtil.WITH_XERROR_HANDLER(errorHandler);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
                        Native.putLong(children_ptr, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
                        int status =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
                        XlibWrapper.XQueryTree(XToolkit.getDisplay(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
                                get_w(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
                                root_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
                                parent_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
                                children_ptr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
                                nchildren_ptr                   );
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
                        if (errorHandler != null) {
17679
a81555868357 8005607: Recursion in J2DXErrHandler() Causes a Stack Overflow on Linux
alitvinov
parents: 5506
diff changeset
    75
                            XErrorHandlerUtil.RESTORE_XERROR_HANDLER();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
                        return status;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
                } finally {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
                    XToolkit.awtUnlock();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        public boolean isExecuted() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
            return __executed;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        public boolean isDisposed() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
            return disposer.disposed;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        public void dispose() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
            XToolkit.awtLock();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
                if (isDisposed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
                    return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
                disposer.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
            } finally {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
                XToolkit.awtUnlock();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
        public long get_w() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
                if (isDisposed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
                    throw new IllegalStateException("Disposed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
                if (!__executed) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
                    throw new IllegalStateException("Not executed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
                return _w;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
        public void set_w(long data) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
                _w = data;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        public long get_root() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
                if (isDisposed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
                    throw new IllegalStateException("Disposed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
                if (!__executed) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
                    throw new IllegalStateException("Not executed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
                return Native.getLong(root_ptr);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        public void set_root(long data) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
                Native.putLong(root_ptr, data);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        public long get_parent() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
                if (isDisposed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
                    throw new IllegalStateException("Disposed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
                if (!__executed) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
                    throw new IllegalStateException("Not executed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
                return Native.getLong(parent_ptr);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        public void set_parent(long data) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
                Native.putLong(parent_ptr, data);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        public long get_children() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
                if (isDisposed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
                    throw new IllegalStateException("Disposed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
                if (!__executed) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
                    throw new IllegalStateException("Not executed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
                return Native.getLong(children_ptr);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        public void set_children(long data) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
                Native.putLong(children_ptr, data);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        public int get_nchildren() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
                if (isDisposed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
                    throw new IllegalStateException("Disposed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
                if (!__executed) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
                    throw new IllegalStateException("Not executed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
                return Native.getInt(nchildren_ptr);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        public void set_nchildren(int data) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                Native.putInt(nchildren_ptr, data);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
}