{"action":"opened","issue":{"url":"https://api.github.com/repos/CppMicroServices/CppMicroServices/issues/282","repository_url":"https://api.github.com/repos/CppMicroServices/CppMicroServices","labels_url":"https://api.github.com/repos/CppMicroServices/CppMicroServices/issues/282/labels{/name}","comments_url":"https://api.github.com/repos/CppMicroServices/CppMicroServices/issues/282/comments","events_url":"https://api.github.com/repos/CppMicroServices/CppMicroServices/issues/282/events","html_url":"https://github.com/CppMicroServices/CppMicroServices/issues/282","id":334079117,"node_id":"MDU6SXNzdWUzMzQwNzkxMTc=","number":282,"title":"virtual method called in destructor of ServiceTracker.","user":{"login":"karthikreddy09","id":12501293,"node_id":"MDQ6VXNlcjEyNTAxMjkz","avatar_url":"https://avatars1.githubusercontent.com/u/12501293?v=4","gravatar_id":"","url":"https://api.github.com/users/karthikreddy09","html_url":"https://github.com/karthikreddy09","followers_url":"https://api.github.com/users/karthikreddy09/followers","following_url":"https://api.github.com/users/karthikreddy09/following{/other_user}","gists_url":"https://api.github.com/users/karthikreddy09/gists{/gist_id}","starred_url":"https://api.github.com/users/karthikreddy09/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karthikreddy09/subscriptions","organizations_url":"https://api.github.com/users/karthikreddy09/orgs","repos_url":"https://api.github.com/users/karthikreddy09/repos","events_url":"https://api.github.com/users/karthikreddy09/events{/privacy}","received_events_url":"https://api.github.com/users/karthikreddy09/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-20T13:33:51Z","updated_at":"2018-06-20T13:33:51Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Here's the log from Clang-tidy with the clang-analyzer check.\r\n\r\n```\r\n?/CppMicroServices/include/cppmicroservices/detail/ServiceTracker.tpp:41:3: warning: Call to virtual function during destruction [clang-analyzer-optin.cplusplus.VirtualCall]\r\n  Close();\r\n  ^\r\n?/SCRLogger.cpp:39:5: note: Calling '~unique_ptr'\r\n    }\r\n    ^\r\n?/include/c++/v1/memory:2588:19: note: Calling 'unique_ptr::reset'\r\n  ~unique_ptr() { reset(); }\r\n                  ^\r\n?/include/c++/v1/memory:2633:9: note: Assuming '__tmp' is non-null\r\n    if (__tmp)\r\n        ^\r\n?/include/c++/v1/memory:2633:5: note: Taking true branch\r\n    if (__tmp)\r\n    ^\r\n?/include/c++/v1/memory:2634:7: note: Calling 'default_delete::operator()'\r\n      __ptr_.second()(__tmp);\r\n      ^\r\n?/include/c++/v1/memory:2321:5: note: Calling '~ServiceTracker'\r\n    delete __ptr;\r\n    ^\r\n?/CppMicroServices/include/cppmicroservices/detail/ServiceTracker.tpp:41:3: note: This destructor of an object of type '~ServiceTracker' has not returned when the virtual method was called\r\n  Close();\r\n  ^\r\n?/CppMicroServices/include/cppmicroservices/detail/ServiceTracker.tpp:41:3: note: Call to virtual function during destruction\r\n?/CppMicroServices/include/cppmicroservices/detail/ServiceTracker.tpp:151:16: warning: Call to virtual function during destruction [clang-analyzer-optin.cplusplus.VirtualCall]\r\n  references = GetServiceReferences();\r\n               ^\r\n?/SCRLogger.cpp:39:5: note: Calling '~unique_ptr'\r\n    }\r\n    ^\r\n?/include/c++/v1/memory:2588:19: note: Calling 'unique_ptr::reset'\r\n  ~unique_ptr() { reset(); }\r\n                  ^\r\n?/include/c++/v1/memory:2633:9: note: Assuming '__tmp' is non-null\r\n    if (__tmp)\r\n        ^\r\n?/include/c++/v1/memory:2633:5: note: Taking true branch\r\n    if (__tmp)\r\n    ^\r\n?/include/c++/v1/memory:2634:7: note: Calling 'default_delete::operator()'\r\n      __ptr_.second()(__tmp);\r\n      ^\r\n?/include/c++/v1/memory:2321:5: note: Calling '~ServiceTracker'\r\n    delete __ptr;\r\n    ^\r\n?/CppMicroServices/include/cppmicroservices/detail/ServiceTracker.tpp:41:3: note: This destructor of an object of type '~ServiceTracker' has not returned when the virtual method was called\r\n  Close();\r\n  ^\r\n?/CppMicroServices/include/cppmicroservices/detail/ServiceTracker.tpp:41:3: note: Calling 'ServiceTracker::Close'\r\n?/CppMicroServices/include/cppmicroservices/detail/ServiceTracker.tpp:144:3: note: Taking false branch\r\n  if (outgoing == nullptr)\r\n  ^\r\n?/CppMicroServices/include/cppmicroservices/detail/ServiceTracker.tpp:151:16: note: Call to virtual function during destruction\r\n  references = GetServiceReferences();\r\n               ^\r\n?/CppMicroServices/include/cppmicroservices/detail/ServiceTracker.tpp:41:3: warning: Call to virtual function during destruction [clang-analyzer-optin.cplusplus.VirtualCall]\r\n```\r\n\r\nI looked at the ServiceTracker class declaration and started thinking ...\r\n\r\nwhy are almost all of the methods in this class virtual? I understand the requirement that \"users should be able to subclass ServiceTracker\" but I think the class is too open to inheritance than is required. \r\n\r\nWhat are the use cases for subclassing? What exactly might the user want to override from the base ServiceTracker and why?"}}
{"actor":{"display_login":"karthikreddy09"}}