Comments (5)
Sounds like it's accessing deleted data. I think it stems from AttributeDictionary::get_attribute
I creates a TypedValue value_out;
on the stack - and then return this as a copy. But the deconstructor for value_out
will release the Ref once the function exits;
The temporary TypedValue
in AttributeDictionary::get_attribute
needs to be non-owning.
This also means that the wrapper objects needs to generally be passed as refs (C++ refs) as parameters to other functions.
Side node, I think owned
is a more precise term than attached
;
https://github.com/jimfoltz/Sketchup-API-C-Wrapper/blob/28c8523905832c84ab77802a49c6bb904a170a01/include/SUAPI-CppWrapper/model/Entity.hpp#L59-L62
from sketchup-api-c-wrapper.
I have a feeling that this commit will fix the issue:
4c1837f
...but needs testing.
I am beginning to think that casting wrapper objects to Ref* pointers may be a bad idea. I thought it might be useful once, now I think it makes it more likely that mistakes are made with its use.
Side node, I think owned is a more precise term than attached;
I disagree - 'owned' could suggest that the wrapper object owns the Ref that it is wrapping, or that the Ref is owned by another parent Ref. Besides, general users tend not to have to deal with this variable - it is only for the developers really.
from sketchup-api-c-wrapper.
I am beginning to think that casting wrapper objects to Ref* pointers may be a bad idea. I thought it might be useful once, now I think it makes it more likely that mistakes are made with its use.
Agree - one should be careful with implicit casts.
from sketchup-api-c-wrapper.
...but needs testing.
Did you try with Jim's unit tests?
from sketchup-api-c-wrapper.
So it doesn't solve the problem, according to Jim here: 4c1837f
I'll take a look at it once I have my testing environment set up.
from sketchup-api-c-wrapper.
Related Issues (20)
- Question about ctgmath and tgmath.h HOT 3
- Removing member variables of derived classes - single_member branch HOT 3
- Consider using a .editorconfig file HOT 4
- No Visual Studio / XCode project/solutions? HOT 13
- Test units - GoogleTest
- Type checking for TypedValue getters? HOT 6
- TypedValue::bool_value() HOT 4
- Question on SUStringRelease for a vector<SUStringRef> HOT 3
- String::std_string() returns null terminator as part of string. HOT 11
- Natviz for Wrapper objects HOT 2
- Expected behaviour of Radians roll-around? HOT 4
- Warnings: Returning address of local variable HOT 7
- Raise error level
- Editor Config with CMake? HOT 1
- CMake configuration for XCode HOT 6
- When to check for validity of parameters, and when not to HOT 4
- Function that returns a list of all verticeswith their correct transforms. HOT 1
- Destructors and inheritance; risk of UB HOT 5
- [[maybe_unused]] an alternative to _unused HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sketchup-api-c-wrapper.