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 double warning display for database open #1037

Conversation

louib
Copy link
Member

@louib louib commented Oct 5, 2017

Second attempt to fix #741, after #744
Rebased on 2.2.2.

How has this been tested?

Locally, by opening a database with a keyfile, and testing the error message when providing an invalid path.

Types of changes

  • ✅ Bug fix (non-breaking change which fixes an issue)

Checklist:

  • ✅ I have read the CONTRIBUTING document. [REQUIRED]
  • ✅ My code follows the code style of this project. [REQUIRED]
  • ✅ All new and existing tests passed. [REQUIRED]
  • ✅ I have compiled and verified my code with -DWITH_ASAN=ON. [REQUIRED]

@louib louib added this to the 2.2.2 milestone Oct 5, 2017
{
CompositeKey masterKey;
CompositeKey* masterKey = new CompositeKey();
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be a smart pointer of some sort? Right now I don't see you deleting this instance anywhere.

Copy link
Member Author

Choose a reason for hiding this comment

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

It could be, yeah. It's deleted line 215 if the key is invalid, otherwise it's deleted at the end of openDatabase()

Copy link
Member

Choose a reason for hiding this comment

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

Im in favor of using smart/scoped pointers for these key components from here on out.

Copy link
Member Author

@louib louib Oct 16, 2017

Choose a reason for hiding this comment

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

@droidmonkey @phoerious now using a QScopedPointer in openDatabase()

Copy link
Member

Choose a reason for hiding this comment

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

You should use and return a QSharedPointer here, not a QScopedPointer. With a QScopedPointer you have no idea when the object will be deleted and it may as well be deleted never or twice.

{
CompositeKey masterKey;
CompositeKey* masterKey = new CompositeKey();
Copy link
Member

Choose a reason for hiding this comment

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

You should use and return a QSharedPointer here, not a QScopedPointer. With a QScopedPointer you have no idea when the object will be deleted and it may as well be deleted never or twice.

@droidmonkey
Copy link
Member

@louib @phoerious is this ready for merging?

@phoerious
Copy link
Member

As I said, I would prefer a QSharedPointer instead of a QScopedPointer as the ownership of pointers as return values is unclear otherwise.

@phoerious phoerious force-pushed the fix_double_warning_invalid_key_file branch from d394c10 to b219107 Compare October 21, 2017 12:01
@phoerious phoerious force-pushed the fix_double_warning_invalid_key_file branch from f11ea93 to 0c18f6a Compare October 21, 2017 12:11
@phoerious phoerious merged commit aba2acb into keepassxreboot:release/2.2.2 Oct 21, 2017
@louib louib deleted the fix_double_warning_invalid_key_file branch October 21, 2017 12:57
@louib
Copy link
Member Author

louib commented Oct 21, 2017

Thanks for that @phoerious!

phoerious added a commit that referenced this pull request Oct 21, 2017
- Fixed entries with empty URLs being reported to KeePassHTTP clients [#1031]
- Fixed YubiKey detection and enabled CLI tool for AppImage binary [#1100]
- Added AppStream description [#1082]
- Improved TOTP compatibility and added new Base32 implementation [#1069]
- Fixed error handling when processing invalid cipher stream [#1099]
- Fixed double warning display when opening a database [#1037]
- Fixed unlocking databases with --pw-stdin [#1087]
- Added ability to override QT_PLUGIN_PATH environment variable for AppImages [#1079]
- Fixed transform seed not being regenerated when saving the database [#1068]
- Fixed only one YubiKey slot being polled [#1048]
- Corrected an issue with entry icons while merging [#1008]
- Corrected desktop and tray icons in Snap package [#1030]
- Fixed screen lock and Google fallback settings [#1029]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants