4 ms·
If that's the case, I don't think it should be calling raptor_uri_copy, which allocates a whole new URI object (not just changing some reference counts). It cou
by dbaupp 8y ago
If that's the case, I don't think it should be calling raptor_uri_copy, which allocates a whole new URI object (not just changing some reference counts). It could instead provide a "URI full_copy()" method that better models how the C API works.
Even then, it still isn't safe, because D doesn't (yet) seem to have the tools required to tie this sort of non-owning reference to the owning object, to avoid the dangling pointer problem mentioned in the article.
- htfy96 8y agoI'm not a D expert, but I think the raptor_uri_copy is called in dup() method of URIWithoutFinalize/URI, which is essentially the full_copy() method. The code says only URIWithoutFinalize() is shallow-copyable, and URIWithFinalize is not (see @disable this(this);).