Closed shierei closed 5 years ago
This seems to be related to creating a UserObject using a reference or a copy of the C++ object. Currently it uses a reference and the referenced object apparently was freed or out of scope after the member function returns. I tried the fix below and that seemed to have corrected the problem.
In userpropertyimpl.inl, there is the following code:
template <typename A>
Value UserPropertyImpl<A>::getValue(const UserObject& object) const
{
return ToUserObject<A::canWrite>::get(
m_accessor.m_interface.getter(object.get<typename A::ClassType>()));
}
I changed it to
template <typename A>
Value UserPropertyImpl<A>::getValue(const UserObject& object) const
{
return ToUserObject<A::RefTraits::isRef>::get(
m_accessor.m_interface.getter(object.get<typename A::ClassType>()));
}
I had a bit of time to look at this this evening. - I merged your change in, but I think my code was right in the first place. The spurious getObject()
function was confusing (and now removed).
I put in some extra tests in the UserProperty tests which I think mirror your behaviour above and they seem to work ok.
Would you mind branching off the develop
branch if you have future fixes please. I'm sort of following Github workflow. I should put some notes up. 🎶
I used my forked master branch to submit my first pull request which completed the comparison operators for ponder::Value. That was a mistake because I accidentally push my working branch to the master branch. However, the pull request for this fix supposedly was directly from my dev branch instead of from the master branch. Did you still see it not following the Github workflow?
Unfortunately your recent fix on top of my fix broke it again. See the attached modified simple.cpp to illustrate the bug introduced.
Unfortunately your recent fix on top of my fix broke it again. See the attached modified simple.cpp to illustrate the bug introduced.
I needed to fix for return by value. There should be unit tests for all cases now.
Thanks for your patience. Tiring doing this and a day job! I'll push out 3.1.
I used my forked master branch to submit my first pull request which completed the comparison operators for ponder::Value. That was a mistake because I accidentally push my working branch to the master branch.
Yep that was it. If people fix master then I end up working in master and ideally only merges from the release branch should go into master. Then you have clear release points. Otherwise it's a moving target. - I suppose one way to fix it is to make develop the exposed branch in GH and then point people to master who want a release point.
Suppose I define a object type as follows.
And use it for a property type of the Person class in simple.cpp.
Register it.
Testing it as below.
I expected
retObj = obj
but the output is:a = -10368 b = 32767