[arrayfire] 32/75: Properly handle af_release_array when using a different backend

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Feb 29 08:01:12 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch dfsg-clean
in repository arrayfire.

commit 52158efc3a6ff3c14343f033e2fec7d9c0e24e55
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Tue Feb 16 13:26:16 2016 -0500

    Properly handle af_release_array when using a different backend
---
 src/api/unified/array.cpp | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/api/unified/array.cpp b/src/api/unified/array.cpp
index 7d4f948..809c9d4 100644
--- a/src/api/unified/array.cpp
+++ b/src/api/unified/array.cpp
@@ -41,8 +41,16 @@ af_err af_get_data_ptr(void *data, const af_array arr)
 
 af_err af_release_array(af_array arr)
 {
-    CHECK_ARRAYS(arr);
-    return CALL(arr);
+    af_backend curr = unified::AFSymbolManager::getInstance().getActiveBackend();
+    af_backend other = curr;
+
+    af_err err = af_get_backend_id(&other, arr);
+    if (err != AF_SUCCESS) return err;
+
+    unified::AFSymbolManager::getInstance().setBackend(other);
+    err = CALL(arr);
+    unified::AFSymbolManager::getInstance().setBackend(curr);
+    return err;
 }
 
 af_err af_retain_array(af_array *out, const af_array in)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git



More information about the debian-science-commits mailing list