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 locking database when password generator is triggered from browser extension #9821

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/browser/BrowserService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,8 @@ void BrowserService::showPasswordGenerator(const KeyPairMessage& keyPairMessage)
if (!m_passwordGenerator) {
m_passwordGenerator.reset(PasswordGeneratorWidget::popupGenerator(m_currentDatabaseWidget));

connect(m_currentDatabaseWidget, SIGNAL(databaseLockRequested()), m_passwordGenerator.data(), SIGNAL(closed()));
Copy link
Member

Choose a reason for hiding this comment

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

This works but it should really call a slot like hide or reject.

Copy link
Member Author

Choose a reason for hiding this comment

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

Is there even those slots in that class? Everything just signals closed().

Copy link
Member

Choose a reason for hiding this comment

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

Generally, you never want to rely on the fact that a signal is listened to. We happen to listen to it internally to the password generator, but that's not necessarily the case. If you call the hide slot it should emit the closed signal which then executes the rest of the sequence.

Copy link
Member Author

@varjolintu varjolintu Sep 3, 2023

Choose a reason for hiding this comment

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

This is best to done to the other PR. We'll have to make sure the m_passwordGeneratorRequested is set to false if we use hide() and the pointer is destroyed. Just changing the SIGNAL(closed()) to SLOT(hide()) here does not work. This was the reason I just called closed(). hide() does not seem to call it afterwards (same with reject()).

Copy link
Member

Choose a reason for hiding this comment

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

Yah that was part of the fixes in the other PR.


connect(m_passwordGenerator.data(), &PasswordGeneratorWidget::closed, m_passwordGenerator.data(), [=] {
if (!m_passwordGenerator->isPasswordGenerated()) {
auto errorMessage = browserMessageBuilder()->getErrorReply("generate-password",
Expand Down