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

Don't use std::unique_ptr for SVEvent #3870

Closed
wants to merge 1 commit into from
Closed
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
12 changes: 6 additions & 6 deletions src/viewer/scrollview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void ScrollView::MessageReceiver() {
// the events accordingly.
while (true) {
// The new event we create.
std::unique_ptr<SVEvent> cur(new SVEvent);
SVEvent *cur(new SVEvent);
// The ID of the corresponding window.
int window_id;

Expand Down Expand Up @@ -149,7 +149,7 @@ void ScrollView::MessageReceiver() {
}

// Place two copies of it in the table for the window.
cur->window->SetEvent(cur.get());
cur->window->SetEvent(cur);

// Check if any of the threads currently waiting want it.
std::pair<ScrollView *, SVEventType> awaiting_list(cur->window, cur->type);
Expand All @@ -158,13 +158,13 @@ void ScrollView::MessageReceiver() {
SVET_ANY);
waiting_for_events_mu->lock();
if (waiting_for_events.count(awaiting_list) > 0) {
waiting_for_events[awaiting_list].second = cur.get();
waiting_for_events[awaiting_list].second = cur;
waiting_for_events[awaiting_list].first->Signal();
} else if (waiting_for_events.count(awaiting_list_any) > 0) {
waiting_for_events[awaiting_list_any].second = cur.get();
waiting_for_events[awaiting_list_any].second = cur;
waiting_for_events[awaiting_list_any].first->Signal();
} else if (waiting_for_events.count(awaiting_list_any_window) > 0) {
waiting_for_events[awaiting_list_any_window].second = cur.get();
waiting_for_events[awaiting_list_any_window].second = cur;
waiting_for_events[awaiting_list_any_window].first->Signal();
}
waiting_for_events_mu->unlock();
Expand Down Expand Up @@ -836,7 +836,7 @@ char ScrollView::Wait() {
char ret = '\0';
SVEventType ev_type = SVET_ANY;
do {
std::unique_ptr<SVEvent> ev(AwaitEvent(SVET_ANY));
SVEvent *ev(AwaitEvent(SVET_ANY));
Copy link
Member

@stweil stweil Jul 17, 2022

Choose a reason for hiding this comment

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

4.0.0 already used std::unique_ptr for this functionality (see code).

ev_type = ev->type;
if (ev_type == SVET_INPUT) {
ret = ev->parameter[0];
Expand Down