{"action":"created","issue":{"url":"https://api.github.com/repos/freesig/nuitrack-rs/issues/7","repository_url":"https://api.github.com/repos/freesig/nuitrack-rs","labels_url":"https://api.github.com/repos/freesig/nuitrack-rs/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/freesig/nuitrack-rs/issues/7/comments","events_url":"https://api.github.com/repos/freesig/nuitrack-rs/issues/7/events","html_url":"https://github.com/freesig/nuitrack-rs/issues/7","id":380962895,"node_id":"MDU6SXNzdWUzODA5NjI4OTU=","number":7,"title":"Test smart pointers","user":{"login":"freesig","id":7286454,"node_id":"MDQ6VXNlcjcyODY0NTQ=","avatar_url":"https://avatars2.githubusercontent.com/u/7286454?v=4","gravatar_id":"","url":"https://api.github.com/users/freesig","html_url":"https://github.com/freesig","followers_url":"https://api.github.com/users/freesig/followers","following_url":"https://api.github.com/users/freesig/following{/other_user}","gists_url":"https://api.github.com/users/freesig/gists{/gist_id}","starred_url":"https://api.github.com/users/freesig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freesig/subscriptions","organizations_url":"https://api.github.com/users/freesig/orgs","repos_url":"https://api.github.com/users/freesig/repos","events_url":"https://api.github.com/users/freesig/events{/privacy}","received_events_url":"https://api.github.com/users/freesig/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-15T01:41:48Z","updated_at":"2018-11-15T04:58:08Z","closed_at":null,"author_association":"OWNER","body":"## Idea\r\nSee if returning a smart pointer from c++ as an opaque blob prevents it from being destroyed early.\r\n```rust\r\n//C++\r\nstruct FooWrapper {\r\nFoo * raw;\r\nshared_ptr<Foo> smart;\r\n~FooWrapper(){\r\ncout << \"Bye now\" << endl;\r\n}\r\n}\r\nshared_ptr<Foo> create_foo() {\r\nauto foo = make_shared<foo>();\r\nFooWrapper fw = FooWrapper{ .raw = foo.get(), .smart = foo };\r\nreturn fw;\r\n}\r\n\r\nvoid destroy_foo(FooWrapper foo){}\r\n\r\n//Rust\r\nstruct FooWrapper {\r\nraw: * mut Foo,\r\nsmart: opaque_blob,\r\n}\r\nfn get_foo() {\r\nlet foo = c_land::create_foo();\r\n// Did foo's destructor run because create foo finished?\r\nc_land::destroy_foo(foo);\r\n// It should have run now because there is no more references\r\n}\r\n```\r\n\r\nI'm not sure if this will work because what does c++ think when foo is returned? Does it know that this is the same reference in destroy foo? Need to create a test"},"comment":{"url":"https://api.github.com/repos/freesig/nuitrack-rs/issues/comments/438917799","html_url":"https://github.com/freesig/nuitrack-rs/issues/7#issuecomment-438917799","issue_url":"https://api.github.com/repos/freesig/nuitrack-rs/issues/7","id":438917799,"node_id":"MDEyOklzc3VlQ29tbWVudDQzODkxNzc5OQ==","user":{"login":"freesig","id":7286454,"node_id":"MDQ6VXNlcjcyODY0NTQ=","avatar_url":"https://avatars2.githubusercontent.com/u/7286454?v=4","gravatar_id":"","url":"https://api.github.com/users/freesig","html_url":"https://github.com/freesig","followers_url":"https://api.github.com/users/freesig/followers","following_url":"https://api.github.com/users/freesig/following{/other_user}","gists_url":"https://api.github.com/users/freesig/gists{/gist_id}","starred_url":"https://api.github.com/users/freesig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freesig/subscriptions","organizations_url":"https://api.github.com/users/freesig/orgs","repos_url":"https://api.github.com/users/freesig/repos","events_url":"https://api.github.com/users/freesig/events{/privacy}","received_events_url":"https://api.github.com/users/freesig/received_events","type":"User","site_admin":false},"created_at":"2018-11-15T04:58:08Z","updated_at":"2018-11-15T04:58:08Z","author_association":"OWNER","body":"This is not possible due to #9 "}}
{"actor":{"display_login":"freesig"}}