Comments (4)
Thanks ansoni. Now, there are no class variables in Objective C. Perhaps you meant static; but svgXml is not static.
So, not sure what the issue is here......
from svgquartzrenderer.
Indeed class scope was the wrong wording. Instance scope is how I would describe it.
So we have the NSData* svgXml declaration in the header file declared as a private variable. So, when I create an instance of SVQuartzRenderer, it will have a single svgXm variable.
The svgXml pointer gets initialized at the beginning of the parse method, then the data gets parsed which might take a few millisseconds and then the pointer is free'd. If called twice from two different threads at the exact same time, I would expect one or both concurrent method calls to fail with this potential scenario:
1st call creates an NSData object and writes the address to the svgXml variable.
1st call goes on to use the variable.
2nd call creates a new NSData object and overwrites the existing svgXml pointer.
1st call potentially could potentially error here.
2nd call goes on to use the variable.
1st call releases the svgXML variable
2nd call might go bad here?
2nd call tries to release svgXML variable.
I will write some code to verify this behavior so you don't need to waste time if this is Obj-C ignorance on my part.
from svgquartzrenderer.
Hi Anonsi,
The parser is not designed to be thread safe. If two threads need the same parser, they must implement locking
to avoid data corruption.
from svgquartzrenderer.
BTW, Anonsi, private just means that derived classes do not have access to the variable. It doesn't mean that two instances of the parser share the same variable. If it is marked static, then it will be shared.
from svgquartzrenderer.
Related Issues (11)
- build error on osx 10.6 with xcode 3.2.4 HOT 1
- Possible bug in applyTransformations
- Referenced Gradients Don't Work
- Rendering looks pixelated on the iPhone 4 HOT 5
- Color names ignored HOT 1
- Multibyte characters support HOT 1
- svgDrawing release HOT 1
- Project won't build out of the box - missing files, missing targets HOT 2
- Problems building SGRenderTouch project
- Hierarchical transforms aren't handled
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 svgquartzrenderer.