Skip to content

Commit 4c59301

Browse files
Alex SakhartchoukAndroid (Google) Code Review
authored andcommitted
Merge "Followup to a bug fix. Addtion of synchronized to the methods triggers an API change. Per council advice, pushing synch block into the function body." into ics-mr1
2 parents 15fe377 + 38da508 commit 4c59301

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

graphics/java/android/renderscript/RSSurfaceView.java

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,24 @@ public void surfaceCreated(SurfaceHolder holder) {
7777
* This method is part of the SurfaceHolder.Callback interface, and is
7878
* not normally called or subclassed by clients of RSSurfaceView.
7979
*/
80-
public synchronized void surfaceDestroyed(SurfaceHolder holder) {
81-
// Surface will be destroyed when we return
82-
if (mRS != null) {
83-
mRS.setSurface(null, 0, 0);
80+
public void surfaceDestroyed(SurfaceHolder holder) {
81+
synchronized (this) {
82+
// Surface will be destroyed when we return
83+
if (mRS != null) {
84+
mRS.setSurface(null, 0, 0);
85+
}
8486
}
8587
}
8688

8789
/**
8890
* This method is part of the SurfaceHolder.Callback interface, and is
8991
* not normally called or subclassed by clients of RSSurfaceView.
9092
*/
91-
public synchronized void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
92-
if (mRS != null) {
93-
mRS.setSurface(holder, w, h);
93+
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
94+
synchronized (this) {
95+
if (mRS != null) {
96+
mRS.setSurface(holder, w, h);
97+
}
9498
}
9599
}
96100

@@ -125,9 +129,11 @@ public RenderScriptGL createRenderScriptGL(RenderScriptGL.SurfaceConfig sc) {
125129
return rs;
126130
}
127131

128-
public synchronized void destroyRenderScriptGL() {
129-
mRS.destroy();
130-
mRS = null;
132+
public void destroyRenderScriptGL() {
133+
synchronized (this) {
134+
mRS.destroy();
135+
mRS = null;
136+
}
131137
}
132138

133139
public void setRenderScriptGL(RenderScriptGL rs) {

0 commit comments

Comments
 (0)