Skip to content

Commit 56ce3c0

Browse files
Ruei-sung LinAndroid (Google) Code Review
authored andcommitted
Merge "Fix b/5821633: Could not activate GLEnvironment" into jb-dev
2 parents af89782 + 22edf6b commit 56ce3c0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

media/mca/filterfw/java/android/filterfw/core/GLEnvironment.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ public class GLEnvironment {
3131

3232
private int glEnvId;
3333

34+
private boolean mManageContext = true;
35+
3436
public GLEnvironment() {
3537
nativeAllocate();
3638
}
@@ -51,12 +53,14 @@ protected void finalize() throws Throwable {
5153
}
5254

5355
public void initWithNewContext() {
56+
mManageContext = true;
5457
if (!nativeInitWithNewContext()) {
5558
throw new RuntimeException("Could not initialize GLEnvironment with new context!");
5659
}
5760
}
5861

5962
public void initWithCurrentContext() {
63+
mManageContext = false;
6064
if (!nativeInitWithCurrentContext()) {
6165
throw new RuntimeException("Could not initialize GLEnvironment with current context!");
6266
}
@@ -78,13 +82,13 @@ public void activate() {
7882
if (Looper.myLooper() != null && Looper.myLooper().equals(Looper.getMainLooper())) {
7983
Log.e("FilterFramework", "Activating GL context in UI thread!");
8084
}
81-
if (!nativeActivate()) {
85+
if (mManageContext && !nativeActivate()) {
8286
throw new RuntimeException("Could not activate GLEnvironment!");
8387
}
8488
}
8589

8690
public void deactivate() {
87-
if (!nativeDeactivate()) {
91+
if (mManageContext && !nativeDeactivate()) {
8892
throw new RuntimeException("Could not deactivate GLEnvironment!");
8993
}
9094
}

0 commit comments

Comments
 (0)