{"action":"created","comment":{"url":"https://api.github.com/repos/boostorg/serialization/pulls/comments/231975693","pull_request_review_id":173063563,"id":231975693,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMTk3NTY5Mw==","diff_hunk":"@@ -150,16 +192,12 @@ class singleton {\n         return get_instance();\n     }\n     BOOST_DLLEXPORT static bool is_destroyed(){\n-        return get_is_destroyed();\n-    }\n-    BOOST_DLLEXPORT singleton(){\n-        get_is_destroyed() = false;\n-    }\n-    BOOST_DLLEXPORT ~singleton() {\n-        get_is_destroyed() = true;\n+        return detail::singleton_wrapper< T >::is_destroyed();\n     }\n };\n \n+// Assigning the instance reference to a static member forces initialization\n+// at startup time as described in http://tinyurl.com/ljdp8\n template<class T>\n T & singleton< T >::m_instance = singleton< T >::get_instance();","path":"include/boost/serialization/singleton.hpp","position":135,"original_position":135,"commit_id":"57094e19e983db6306e139357d7a4c7ad322d104","original_commit_id":"57094e19e983db6306e139357d7a4c7ad322d104","user":{"login":"robertramey","id":1970652,"node_id":"MDQ6VXNlcjE5NzA2NTI=","avatar_url":"https://avatars1.githubusercontent.com/u/1970652?v=4","gravatar_id":"","url":"https://api.github.com/users/robertramey","html_url":"https://github.com/robertramey","followers_url":"https://api.github.com/users/robertramey/followers","following_url":"https://api.github.com/users/robertramey/following{/other_user}","gists_url":"https://api.github.com/users/robertramey/gists{/gist_id}","starred_url":"https://api.github.com/users/robertramey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertramey/subscriptions","organizations_url":"https://api.github.com/users/robertramey/orgs","repos_url":"https://api.github.com/users/robertramey/repos","events_url":"https://api.github.com/users/robertramey/events{/privacy}","received_events_url":"https://api.github.com/users/robertramey/received_events","type":"User","site_admin":false},"body":"Note on locking.  Strictly speaking this \"locking\" feature is not necessary.  In the serialization library I wanted all my singletons to be constant - ie not mutable.  I wanted to trap attempts to modify them after main is called.  But of course that means I want to force creation on program/shared library load.  So I'm fine with the comment.  I would recommend that the comment not point to a link - even if the text is longer.  The serialization library will likely persist in usage long after the link is gone.","created_at":"2018-11-08T16:49:11Z","updated_at":"2018-11-08T16:49:11Z","html_url":"https://github.com/boostorg/serialization/pull/131#discussion_r231975693","pull_request_url":"https://api.github.com/repos/boostorg/serialization/pulls/131","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/boostorg/serialization/pulls/comments/231975693"},"html":{"href":"https://github.com/boostorg/serialization/pull/131#discussion_r231975693"},"pull_request":{"href":"https://api.github.com/repos/boostorg/serialization/pulls/131"}},"in_reply_to_id":231885804},"pull_request":{"url":"https://api.github.com/repos/boostorg/serialization/pulls/131","id":223898828,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIzODk4ODI4","html_url":"https://github.com/boostorg/serialization/pull/131","diff_url":"https://github.com/boostorg/serialization/pull/131.diff","patch_url":"https://github.com/boostorg/serialization/pull/131.patch","issue_url":"https://api.github.com/repos/boostorg/serialization/issues/131","number":131,"state":"open","locked":false,"title":"Fix singleton::is_destroyed and crash when using shared libraries","user":{"login":"Flamefire","id":309017,"node_id":"MDQ6VXNlcjMwOTAxNw==","avatar_url":"https://avatars2.githubusercontent.com/u/309017?v=4","gravatar_id":"","url":"https://api.github.com/users/Flamefire","html_url":"https://github.com/Flamefire","followers_url":"https://api.github.com/users/Flamefire/followers","following_url":"https://api.github.com/users/Flamefire/following{/other_user}","gists_url":"https://api.github.com/users/Flamefire/gists{/gist_id}","starred_url":"https://api.github.com/users/Flamefire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Flamefire/subscriptions","organizations_url":"https://api.github.com/users/Flamefire/orgs","repos_url":"https://api.github.com/users/Flamefire/repos","events_url":"https://api.github.com/users/Flamefire/events{/privacy}","received_events_url":"https://api.github.com/users/Flamefire/received_events","type":"User","site_admin":false},"body":"This supersedes #105 with a more minimal approach based on current develop. Reason: Current develop contains a change (https://github.com/boostorg/serialization/commit/e1893dd28c408bb25352596e2f91892b3d570164), which I deemed mislead and reverted in #105 (5248dee2528b32907003042da84c5f4d650c470e). Note that the PR predates that change!   \r\nTo have a smaller changeset this revert is not included here.\r\n\r\nAdditionally it includes the crash test #111 and the improved is_destroyed test #129 to show that this does indeed fix the problem. Those PRs should be merged first!\r\n\r\nThe actual fix is https://github.com/boostorg/serialization/commit/c2c6e63c3e72a731e3a64afd8c3549b08f69344f which does the following:  \r\n\r\nWhen a plain singleton `Foo` is used (\"plain\"==\"does not inherit from `singleton<Foo>`) the class `singleton<Foo>` is never instantiated. Hence it is never destroyed. But the `is_destroyed` check on the current develop relies on the destruction of `singleton<Foo>` so the flag is set to false. As that destruction does not happen the flag stays true although `Foo` was destroyed. Accessing it (via `singleton<Foo>::get_const_instance()`) will then access invalid memory and crash (see #111)\r\n\r\nFor this the indirection via the `detail::singleton_wrapper` is required, which also allows usage of `Foo` with a protected ctor, (which is recommended: One should not be able to do e.g. `Foo f;`)\r\n\r\nNote: The alternative is to force all users (`T`) to inherit from `singleton<T>` with the additional advantage that copy construction/assignment can be forbidden in `singleton<>` to avoid even more potential misuses.\r\n\r\nThe 2nd fix commit removes the assertions on `is_destroyed` before it is runtime checked. Due to the runtime check the assertion is not required and unless one can truly and reliably fix the shared-library-issue the runtime check will be required to avoid the crash. Having the assertion in place might make someone assume the runtime check can be removed. Obviously the assertion **will** fail for #111 after  `is_destroyed` is fixed making it 2 reasons to remove.","created_at":"2018-10-18T10:12:37Z","updated_at":"2018-11-08T16:49:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f82c15c27bbc03f0ccbaadd71e33c68dfbd68493","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/boostorg/serialization/pulls/131/commits","review_comments_url":"https://api.github.com/repos/boostorg/serialization/pulls/131/comments","review_comment_url":"https://api.github.com/repos/boostorg/serialization/pulls/comments{/number}","comments_url":"https://api.github.com/repos/boostorg/serialization/issues/131/comments","statuses_url":"https://api.github.com/repos/boostorg/serialization/statuses/57094e19e983db6306e139357d7a4c7ad322d104","head":{"label":"Flamefire:feature/singleton-fix2","ref":"feature/singleton-fix2","sha":"57094e19e983db6306e139357d7a4c7ad322d104","user":{"login":"Flamefire","id":309017,"node_id":"MDQ6VXNlcjMwOTAxNw==","avatar_url":"https://avatars2.githubusercontent.com/u/309017?v=4","gravatar_id":"","url":"https://api.github.com/users/Flamefire","html_url":"https://github.com/Flamefire","followers_url":"https://api.github.com/users/Flamefire/followers","following_url":"https://api.github.com/users/Flamefire/following{/other_user}","gists_url":"https://api.github.com/users/Flamefire/gists{/gist_id}","starred_url":"https://api.github.com/users/Flamefire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Flamefire/subscriptions","organizations_url":"https://api.github.com/users/Flamefire/orgs","repos_url":"https://api.github.com/users/Flamefire/repos","events_url":"https://api.github.com/users/Flamefire/events{/privacy}","received_events_url":"https://api.github.com/users/Flamefire/received_events","type":"User","site_admin":false},"repo":{"id":131164248,"node_id":"MDEwOlJlcG9zaXRvcnkxMzExNjQyNDg=","name":"serialization","full_name":"Flamefire/serialization","private":false,"owner":{"login":"Flamefire","id":309017,"node_id":"MDQ6VXNlcjMwOTAxNw==","avatar_url":"https://avatars2.githubusercontent.com/u/309017?v=4","gravatar_id":"","url":"https://api.github.com/users/Flamefire","html_url":"https://github.com/Flamefire","followers_url":"https://api.github.com/users/Flamefire/followers","following_url":"https://api.github.com/users/Flamefire/following{/other_user}","gists_url":"https://api.github.com/users/Flamefire/gists{/gist_id}","starred_url":"https://api.github.com/users/Flamefire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Flamefire/subscriptions","organizations_url":"https://api.github.com/users/Flamefire/orgs","repos_url":"https://api.github.com/users/Flamefire/repos","events_url":"https://api.github.com/users/Flamefire/events{/privacy}","received_events_url":"https://api.github.com/users/Flamefire/received_events","type":"User","site_admin":false},"html_url":"https://github.com/Flamefire/serialization","description":"Boost.org serialization module","fork":true,"url":"https://api.github.com/repos/Flamefire/serialization","forks_url":"https://api.github.com/repos/Flamefire/serialization/forks","keys_url":"https://api.github.com/repos/Flamefire/serialization/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Flamefire/serialization/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Flamefire/serialization/teams","hooks_url":"https://api.github.com/repos/Flamefire/serialization/hooks","issue_events_url":"https://api.github.com/repos/Flamefire/serialization/issues/events{/number}","events_url":"https://api.github.com/repos/Flamefire/serialization/events","assignees_url":"https://api.github.com/repos/Flamefire/serialization/assignees{/user}","branches_url":"https://api.github.com/repos/Flamefire/serialization/branches{/branch}","tags_url":"https://api.github.com/repos/Flamefire/serialization/tags","blobs_url":"https://api.github.com/repos/Flamefire/serialization/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Flamefire/serialization/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Flamefire/serialization/git/refs{/sha}","trees_url":"https://api.github.com/repos/Flamefire/serialization/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Flamefire/serialization/statuses/{sha}","languages_url":"https://api.github.com/repos/Flamefire/serialization/languages","stargazers_url":"https://api.github.com/repos/Flamefire/serialization/stargazers","contributors_url":"https://api.github.com/repos/Flamefire/serialization/contributors","subscribers_url":"https://api.github.com/repos/Flamefire/serialization/subscribers","subscription_url":"https://api.github.com/repos/Flamefire/serialization/subscription","commits_url":"https://api.github.com/repos/Flamefire/serialization/commits{/sha}","git_commits_url":"https://api.github.com/repos/Flamefire/serialization/git/commits{/sha}","comments_url":"https://api.github.com/repos/Flamefire/serialization/comments{/number}","issue_comment_url":"https://api.github.com/repos/Flamefire/serialization/issues/comments{/number}","contents_url":"https://api.github.com/repos/Flamefire/serialization/contents/{+path}","compare_url":"https://api.github.com/repos/Flamefire/serialization/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Flamefire/serialization/merges","archive_url":"https://api.github.com/repos/Flamefire/serialization/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Flamefire/serialization/downloads","issues_url":"https://api.github.com/repos/Flamefire/serialization/issues{/number}","pulls_url":"https://api.github.com/repos/Flamefire/serialization/pulls{/number}","milestones_url":"https://api.github.com/repos/Flamefire/serialization/milestones{/number}","notifications_url":"https://api.github.com/repos/Flamefire/serialization/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Flamefire/serialization/labels{/name}","releases_url":"https://api.github.com/repos/Flamefire/serialization/releases{/id}","deployments_url":"https://api.github.com/repos/Flamefire/serialization/deployments","created_at":"2018-04-26T14:00:42Z","updated_at":"2018-04-26T14:00:45Z","pushed_at":"2018-11-07T08:24:10Z","git_url":"git://github.com/Flamefire/serialization.git","ssh_url":"git@github.com:Flamefire/serialization.git","clone_url":"https://github.com/Flamefire/serialization.git","svn_url":"https://github.com/Flamefire/serialization","homepage":"http://boost.org/libs/serialization","size":16178,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"boostorg:develop","ref":"develop","sha":"efcd46eb1be621e212b3d31fae12cdd7230cdfe3","user":{"login":"boostorg","id":3170529,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxNzA1Mjk=","avatar_url":"https://avatars0.githubusercontent.com/u/3170529?v=4","gravatar_id":"","url":"https://api.github.com/users/boostorg","html_url":"https://github.com/boostorg","followers_url":"https://api.github.com/users/boostorg/followers","following_url":"https://api.github.com/users/boostorg/following{/other_user}","gists_url":"https://api.github.com/users/boostorg/gists{/gist_id}","starred_url":"https://api.github.com/users/boostorg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boostorg/subscriptions","organizations_url":"https://api.github.com/users/boostorg/orgs","repos_url":"https://api.github.com/users/boostorg/repos","events_url":"https://api.github.com/users/boostorg/events{/privacy}","received_events_url":"https://api.github.com/users/boostorg/received_events","type":"Organization","site_admin":false},"repo":{"id":7590009,"node_id":"MDEwOlJlcG9zaXRvcnk3NTkwMDA5","name":"serialization","full_name":"boostorg/serialization","private":false,"owner":{"login":"boostorg","id":3170529,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxNzA1Mjk=","avatar_url":"https://avatars0.githubusercontent.com/u/3170529?v=4","gravatar_id":"","url":"https://api.github.com/users/boostorg","html_url":"https://github.com/boostorg","followers_url":"https://api.github.com/users/boostorg/followers","following_url":"https://api.github.com/users/boostorg/following{/other_user}","gists_url":"https://api.github.com/users/boostorg/gists{/gist_id}","starred_url":"https://api.github.com/users/boostorg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boostorg/subscriptions","organizations_url":"https://api.github.com/users/boostorg/orgs","repos_url":"https://api.github.com/users/boostorg/repos","events_url":"https://api.github.com/users/boostorg/events{/privacy}","received_events_url":"https://api.github.com/users/boostorg/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/boostorg/serialization","description":"Boost.org serialization module","fork":false,"url":"https://api.github.com/repos/boostorg/serialization","forks_url":"https://api.github.com/repos/boostorg/serialization/forks","keys_url":"https://api.github.com/repos/boostorg/serialization/keys{/key_id}","collaborators_url":"https://api.github.com/repos/boostorg/serialization/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/boostorg/serialization/teams","hooks_url":"https://api.github.com/repos/boostorg/serialization/hooks","issue_events_url":"https://api.github.com/repos/boostorg/serialization/issues/events{/number}","events_url":"https://api.github.com/repos/boostorg/serialization/events","assignees_url":"https://api.github.com/repos/boostorg/serialization/assignees{/user}","branches_url":"https://api.github.com/repos/boostorg/serialization/branches{/branch}","tags_url":"https://api.github.com/repos/boostorg/serialization/tags","blobs_url":"https://api.github.com/repos/boostorg/serialization/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/boostorg/serialization/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/boostorg/serialization/git/refs{/sha}","trees_url":"https://api.github.com/repos/boostorg/serialization/git/trees{/sha}","statuses_url":"https://api.github.com/repos/boostorg/serialization/statuses/{sha}","languages_url":"https://api.github.com/repos/boostorg/serialization/languages","stargazers_url":"https://api.github.com/repos/boostorg/serialization/stargazers","contributors_url":"https://api.github.com/repos/boostorg/serialization/contributors","subscribers_url":"https://api.github.com/repos/boostorg/serialization/subscribers","subscription_url":"https://api.github.com/repos/boostorg/serialization/subscription","commits_url":"https://api.github.com/repos/boostorg/serialization/commits{/sha}","git_commits_url":"https://api.github.com/repos/boostorg/serialization/git/commits{/sha}","comments_url":"https://api.github.com/repos/boostorg/serialization/comments{/number}","issue_comment_url":"https://api.github.com/repos/boostorg/serialization/issues/comments{/number}","contents_url":"https://api.github.com/repos/boostorg/serialization/contents/{+path}","compare_url":"https://api.github.com/repos/boostorg/serialization/compare/{base}...{head}","merges_url":"https://api.github.com/repos/boostorg/serialization/merges","archive_url":"https://api.github.com/repos/boostorg/serialization/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/boostorg/serialization/downloads","issues_url":"https://api.github.com/repos/boostorg/serialization/issues{/number}","pulls_url":"https://api.github.com/repos/boostorg/serialization/pulls{/number}","milestones_url":"https://api.github.com/repos/boostorg/serialization/milestones{/number}","notifications_url":"https://api.github.com/repos/boostorg/serialization/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/boostorg/serialization/labels{/name}","releases_url":"https://api.github.com/repos/boostorg/serialization/releases{/id}","deployments_url":"https://api.github.com/repos/boostorg/serialization/deployments","created_at":"2013-01-13T15:59:24Z","updated_at":"2018-11-07T12:38:11Z","pushed_at":"2018-11-07T08:24:12Z","git_url":"git://github.com/boostorg/serialization.git","ssh_url":"git@github.com:boostorg/serialization.git","clone_url":"https://github.com/boostorg/serialization.git","svn_url":"https://github.com/boostorg/serialization","homepage":"http://boost.org/libs/serialization","size":16168,"stargazers_count":47,"watchers_count":47,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":78,"mirror_url":null,"archived":false,"open_issues_count":29,"license":null,"forks":78,"open_issues":29,"watchers":47,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/boostorg/serialization/pulls/131"},"html":{"href":"https://github.com/boostorg/serialization/pull/131"},"issue":{"href":"https://api.github.com/repos/boostorg/serialization/issues/131"},"comments":{"href":"https://api.github.com/repos/boostorg/serialization/issues/131/comments"},"review_comments":{"href":"https://api.github.com/repos/boostorg/serialization/pulls/131/comments"},"review_comment":{"href":"https://api.github.com/repos/boostorg/serialization/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/boostorg/serialization/pulls/131/commits"},"statuses":{"href":"https://api.github.com/repos/boostorg/serialization/statuses/57094e19e983db6306e139357d7a4c7ad322d104"}},"author_association":"NONE"}}
{"actor":{"display_login":"robertramey"}}