Merge "Fix transactionCallbackThunk lifetime issue" into main
diff --git a/libs/gui/BLASTBufferQueue.cpp b/libs/gui/BLASTBufferQueue.cpp
index f065ffa..1fb59fd 100644
--- a/libs/gui/BLASTBufferQueue.cpp
+++ b/libs/gui/BLASTBufferQueue.cpp
@@ -356,8 +356,9 @@
     if (context == nullptr) {
         return;
     }
-    sp<BLASTBufferQueue> bq = static_cast<BLASTBufferQueue*>(context);
+    auto bq = static_cast<BLASTBufferQueue*>(context);
     bq->transactionCallback(latchTime, presentFence, stats);
+    bq->decStrong((void*)transactionCallbackThunk);
 }
 
 void BLASTBufferQueue::transactionCallback(nsecs_t /*latchTime*/, const sp<Fence>& /*presentFence*/,
@@ -413,8 +414,6 @@
             BQA_LOGE("No matching SurfaceControls found: mSurfaceControlsWithPendingCallback was "
                      "empty.");
         }
-
-        decStrong((void*)transactionCallbackThunk);
     }
 }