Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b7a2da61 authored by Steve Kondik's avatar Steve Kondik Committed by Gerrit Code Review
Browse files

Merge "Check for strongCount of Surface to avoid double delete in ~Surface()" into gingerbread

parents b747a8f1 6ef17e36
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -157,7 +157,13 @@ static void setSurfaceControl(JNIEnv* env, jobject clazz,

static sp<Surface> getSurface(JNIEnv* env, jobject clazz)
{
    sp<Surface> result((Surface*)env->GetIntField(clazz, so.surface));
    Surface* surface = (Surface*)env->GetIntField(clazz, so.surface);
    RefBase* ref = (RefBase*)surface;

    if (ref && ref->getWeakRefs() && (ref->getStrongCount() < 1))
        return NULL; // dead surface

    sp<Surface> result(surface);
    if (result == 0) {
        /*
         * if this method is called from the WindowManager's process, it means