[pytango] 29/122: Fix #24: dev_status and dangling pointer
Sandor Bodo-Merle
sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:18:15 UTC 2017
This is an automated email from the git hooks/post-receive script.
sbodomerle-guest pushed a commit to tag v9.2.1
in repository pytango.
commit 2433d85b16f65d95fc3876ba4ed59a70b20697d6
Author: Jose Tiago Macara Coutinho <coutinhotiago at gmail.com>
Date: Thu Sep 22 13:03:07 2016 +0200
Fix #24: dev_status and dangling pointer
keep record of last status in internal DeviceImpl member (C++ level)
---
ext/server/device_impl.cpp | 57 ++++++++++++++++++++++++++++++++++++++--------
ext/server/device_impl.h | 2 ++
2 files changed, 50 insertions(+), 9 deletions(-)
diff --git a/ext/server/device_impl.cpp b/ext/server/device_impl.cpp
index e929472..60415ad 100644
--- a/ext/server/device_impl.cpp
+++ b/ext/server/device_impl.cpp
@@ -998,9 +998,22 @@ Tango::DevState Device_3ImplWrap::default_dev_state()
Tango::ConstDevString Device_3ImplWrap::dev_status()
{
- CALL_DEVICE_METHOD_RET(Device_3Impl, dev_status)
- // Keep the compiler quiet
- return "Impossible state";
+ __AUX_DECL_CALL_DEVICE_METHOD
+ try
+ {
+ if (override dev_status = this->get_override("dev_status") )
+ {
+ this->the_status = (const char *)dev_status();
+ }
+ else
+ {
+ this->the_status = Device_3Impl::dev_status();
+ }
+ }
+ __AUX_CATCH_PY_EXCEPTION \
+ __AUX_CATCH_EXCEPTION(dev_status)
+
+ return this->the_status.c_str();
}
Tango::ConstDevString Device_3ImplWrap::default_dev_status()
@@ -1160,9 +1173,22 @@ Tango::DevState Device_4ImplWrap::default_dev_state()
Tango::ConstDevString Device_4ImplWrap::dev_status()
{
- CALL_DEVICE_METHOD_RET(Device_4Impl, dev_status)
- // Keep the compiler quiet
- return "Impossible state";
+ __AUX_DECL_CALL_DEVICE_METHOD
+ try
+ {
+ if (override dev_status = this->get_override("dev_status") )
+ {
+ this->the_status = (const char *)dev_status();
+ }
+ else
+ {
+ this->the_status = Device_4Impl::dev_status();
+ }
+ }
+ __AUX_CATCH_PY_EXCEPTION \
+ __AUX_CATCH_EXCEPTION(dev_status)
+
+ return this->the_status.c_str();
}
Tango::ConstDevString Device_4ImplWrap::default_dev_status()
@@ -1315,9 +1341,22 @@ Tango::DevState Device_5ImplWrap::default_dev_state()
Tango::ConstDevString Device_5ImplWrap::dev_status()
{
- CALL_DEVICE_METHOD_RET(Device_5Impl, dev_status)
- // Keep the compiler quiet
- return "Impossible state";
+ __AUX_DECL_CALL_DEVICE_METHOD
+ try
+ {
+ if (override dev_status = this->get_override("dev_status") )
+ {
+ this->the_status = (const char *)dev_status();
+ }
+ else
+ {
+ this->the_status = Device_5Impl::dev_status();
+ }
+ }
+ __AUX_CATCH_PY_EXCEPTION \
+ __AUX_CATCH_EXCEPTION(dev_status)
+
+ return this->the_status.c_str();
}
Tango::ConstDevString Device_5ImplWrap::default_dev_status()
diff --git a/ext/server/device_impl.h b/ext/server/device_impl.h
index f20e468..dbfc77f 100644
--- a/ext/server/device_impl.h
+++ b/ext/server/device_impl.h
@@ -124,6 +124,8 @@ public:
/** a reference to itself */
PyObject *the_self;
+ std::string the_status;
+
PyDeviceImplBase(PyObject *self);
virtual ~PyDeviceImplBase();
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pytango.git
More information about the debian-science-commits
mailing list