Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add missing destructor for CoreMPL and final for nested classes #359

Closed
wants to merge 1 commit into from

Conversation

knst
Copy link
Contributor

@knst knst commented Feb 23, 2023

There is no actual memory leak because no data in the the CoreMPL

But it resolves clang's warning:

/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/unique_ptr.h:95:2: warning: delete called on non-final 'bls::CoreMPL' that has virtual functions but non-virtual destructor [-Wdelete-non-abstract-non-virtual-dtor]
        delete __ptr;
        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/unique_ptr.h:396:4: note: in instantiation of member function 'std::default_delete<bls::CoreMPL>::operator()' requested here
          get_deleter()(std::move(__ptr));
          ^
main.cpp: note: in instantiation of member function 'std::unique_ptr<bls::CoreMPL>::~unique_ptr' requested here
static const std::unique_ptr<bls::CoreMPL> pSchemeMLP{std::make_unique<bls::BasicSchemeMPL>()};

There is no actual memory leak because no data in the the CoreMPL

But it resolves clang's warning:

    /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/unique_ptr.h:95:2: warning: delete called on non-final 'bls::CoreMPL' that has virtual functions but non-virtual destructor [-Wdelete-non-abstract-non-virtual-dtor]
            delete __ptr;
            ^
    /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/unique_ptr.h:396:4: note: in instantiation of member function 'std::default_delete<bls::CoreMPL>::operator()' requested here
              get_deleter()(std::move(__ptr));
              ^
    main.cpp: note: in instantiation of member function 'std::unique_ptr<bls::CoreMPL>::~unique_ptr' requested here
    static const std::unique_ptr<bls::CoreMPL> pSchemeMLP{std::make_unique<bls::BasicSchemeMPL>()};
@github-actions
Copy link

'This PR has been flagged as stale due to no activity for over 60
days. It will not be automatically closed, but it has been given
a stale-pr label and should be manually reviewed.'

@@ -39,6 +39,7 @@ class CoreMPL {
public:
CoreMPL() = delete;
CoreMPL(const std::string& strId) : strCiphersuiteId(strId) {}
virtual ~CoreMPL() {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this still necessary when you make the other types final?

Copy link
Contributor Author

@knst knst May 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, because final in other class mean just no more inheritance and it doesn't need its own virtual destructor. But above class/struct still needs so

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok. I guess we already have other virtual functions in this class, and we do use it polymorphically. so this seems right.

wallentx added a commit that referenced this pull request May 8, 2023
Signing commit from @knst from #359

Co-Authored-By: Konstantin Akimov <545784+knst@users.noreply.github.com>
@wallentx
Copy link
Contributor

wallentx commented May 8, 2023

Hi @knst, our branch protection rules require that all commits be signed before merging. If you know how to retroactively sign your initial commit, we can proceed with this PR. If you aren't sure how to do that, I've also prepared this PR #371 to merge in, with your attribution listed as co-author.

Please let me know how you'd like me to continue 👍

@github-actions github-actions bot removed the stale-pr label May 9, 2023
@wallentx
Copy link
Contributor

wallentx commented May 9, 2023

@knst I'm going to go ahead and close out this PR, and merge in your changes in #371

@wallentx wallentx closed this May 9, 2023
wallentx added a commit that referenced this pull request May 9, 2023
…371)

Signing commit from @knst from #359

Co-authored-by: Konstantin Akimov <545784+knst@users.noreply.github.com>
UdjinM6 pushed a commit to UdjinM6/bls-signatures that referenced this pull request Jun 10, 2023
…hia-Network#371)

Signing commit from @knst from Chia-Network#359

Co-authored-by: Konstantin Akimov <545784+knst@users.noreply.github.com>
UdjinM6 pushed a commit to UdjinM6/bls-signatures that referenced this pull request Jun 12, 2023
…hia-Network#371)

Signing commit from @knst from Chia-Network#359

Co-authored-by: Konstantin Akimov <545784+knst@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants