Skip to content

Commit 0c987d9

Browse files
Protect disposables from ClassCastException.
1 parent 018b000 commit 0c987d9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

core/src/processing/opengl/PGraphicsOpenGL.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,9 @@ public void disposeNative() {
890890

891891
@Override
892892
public boolean equals(Object obj) {
893+
if (!(obj instanceof GLResourceTexture)) {
894+
return false;
895+
}
893896
GLResourceTexture other = (GLResourceTexture)obj;
894897
return other.glName == glName &&
895898
other.context == context;
@@ -936,6 +939,9 @@ public void disposeNative() {
936939

937940
@Override
938941
public boolean equals(Object obj) {
942+
if (!(obj instanceof GLResourceVertexBuffer)) {
943+
return false;
944+
}
939945
GLResourceVertexBuffer other = (GLResourceVertexBuffer)obj;
940946
return other.glId == glId &&
941947
other.context == context;
@@ -995,6 +1001,9 @@ public void disposeNative() {
9951001

9961002
@Override
9971003
public boolean equals(Object obj) {
1004+
if (!(obj instanceof GLResourceShader)) {
1005+
return false;
1006+
}
9981007
GLResourceShader other = (GLResourceShader)obj;
9991008
return other.glProgram == glProgram &&
10001009
other.glVertex == glVertex &&
@@ -1095,6 +1104,9 @@ public void disposeNative() {
10951104

10961105
@Override
10971106
public boolean equals(Object obj) {
1107+
if (!(obj instanceof GLResourceFrameBuffer)) {
1108+
return false;
1109+
}
10981110
GLResourceFrameBuffer other = (GLResourceFrameBuffer)obj;
10991111
return other.glFbo == glFbo &&
11001112
other.glDepth == glDepth &&

0 commit comments

Comments
 (0)