summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 650fb54)
raw | patch | inline | side by side (parent: 650fb54)
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | |
Fri, 24 Nov 2017 08:51:31 +0000 (10:51 +0200) | ||
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | |
Fri, 24 Nov 2017 08:51:31 +0000 (10:51 +0200) |
py/pykms/pykmsbase.cpp | patch | blob | history |
diff --git a/py/pykms/pykmsbase.cpp b/py/pykms/pykmsbase.cpp
index aae5ecec6ea32e31f5361ec6a52874064ab5c7ee..96ebe7a0858d375eabca40acf6a80559ebc0ca75 100644 (file)
--- a/py/pykms/pykmsbase.cpp
+++ b/py/pykms/pykmsbase.cpp
py::class_<Blob>(m, "Blob")
.def("__init__", [](Blob& instance, Card& card, py::buffer buf) {
- py::buffer_info info = buf.request();
- if (info.ndim != 1)
- throw std::runtime_error("Incompatible buffer dimension!");
+ py::buffer_info info = buf.request();
+ if (info.ndim != 1)
+ throw std::runtime_error("Incompatible buffer dimension!");
+
+ new (&instance) Blob(card, info.ptr, info.size * info.itemsize);
+ },
+ py::keep_alive<1, 3>()) // Keep Card alive until this is destructed
- new (&instance) Blob(card, info.ptr, info.size * info.itemsize);
- })
.def_property_readonly("data", &Blob::data)
// XXX pybind11 doesn't support a base object (DrmObject) with custom holder-type,