Skip to content

Commit

Permalink
fix: indirect memory leak issues
Browse files Browse the repository at this point in the history
  • Loading branch information
saturneric committed Jul 26, 2024
1 parent 3d84bea commit ca3a64b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
6 changes: 4 additions & 2 deletions src/core/model/GFDataExchanger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ auto GFDataExchanger::Write(const std::byte* buffer, size_t size) -> ssize_t {
not_empty_.notify_all();
}

not_full_.wait(lock,
[=] { return queue_.size() < queue_max_size_ || close_; });
not_full_.wait(lock, [=] {
return queue_.size() < static_cast<unsigned long>(queue_max_size_) ||
close_;
});
if (close_) return -1;

queue_.push(buffer[i]);
Expand Down
2 changes: 1 addition & 1 deletion src/ui/main_window/MainWindowUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ void MainWindow::create_tool_bars() {
}

void MainWindow::create_status_bar() {
auto* status_bar_box = new QWidget();
auto* status_bar_box = new QWidget(this);
auto* status_bar_box_layout = new QHBoxLayout();
// QPixmap* pixmap;

Expand Down
14 changes: 7 additions & 7 deletions src/ui/widgets/KeyList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ void KeyList::init() {
KeyMenuAbility::kCOLUMN_FILTER);
ui_->searchBarEdit->setHidden(~menu_ability_ & KeyMenuAbility::kSEARCH_BAR);

auto* column_type_menu = new QMenu();
auto* column_type_menu = new QMenu(this);

key_id_column_action_ = new QAction(tr("Key ID"));
key_id_column_action_ = new QAction(tr("Key ID"), this);
key_id_column_action_->setCheckable(true);
key_id_column_action_->setChecked(
(global_column_filter_ & GpgKeyTableColumn::kKEY_ID) !=
Expand All @@ -82,7 +82,7 @@ void KeyList::init() {
: global_column_filter_ & ~GpgKeyTableColumn::kKEY_ID);
});

algo_column_action_ = new QAction(tr("Algorithm"));
algo_column_action_ = new QAction(tr("Algorithm"), this);
algo_column_action_->setCheckable(true);
algo_column_action_->setChecked(
(global_column_filter_ & GpgKeyTableColumn::kALGO) !=
Expand All @@ -93,7 +93,7 @@ void KeyList::init() {
: global_column_filter_ & ~GpgKeyTableColumn::kALGO);
});

owner_trust_column_action_ = new QAction(tr("Owner Trust"));
owner_trust_column_action_ = new QAction(tr("Owner Trust"), this);
owner_trust_column_action_->setCheckable(true);
owner_trust_column_action_->setChecked(
(global_column_filter_ & GpgKeyTableColumn::kOWNER_TRUST) !=
Expand All @@ -105,7 +105,7 @@ void KeyList::init() {
: global_column_filter_ & ~GpgKeyTableColumn::kOWNER_TRUST);
});

create_date_column_action_ = new QAction(tr("Create Date"));
create_date_column_action_ = new QAction(tr("Create Date"), this);
create_date_column_action_->setCheckable(true);
create_date_column_action_->setChecked(
(global_column_filter_ & GpgKeyTableColumn::kCREATE_DATE) !=
Expand All @@ -117,7 +117,7 @@ void KeyList::init() {
: global_column_filter_ & ~GpgKeyTableColumn::kCREATE_DATE);
});

subkeys_number_column_action_ = new QAction("Subkey(s)");
subkeys_number_column_action_ = new QAction("Subkey(s)", this);
subkeys_number_column_action_->setCheckable(true);
subkeys_number_column_action_->setChecked(
(global_column_filter_ & GpgKeyTableColumn::kSUBKEYS_NUMBER) !=
Expand All @@ -131,7 +131,7 @@ void KeyList::init() {
: global_column_filter_ & ~GpgKeyTableColumn::kSUBKEYS_NUMBER);
});

comment_column_action_ = new QAction("Comment");
comment_column_action_ = new QAction("Comment", this);
comment_column_action_->setCheckable(true);
comment_column_action_->setChecked(
(global_column_filter_ & GpgKeyTableColumn::kCOMMENT) !=
Expand Down

0 comments on commit ca3a64b

Please sign in to comment.