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 memory leaks #9

Merged
merged 1 commit into from
Aug 15, 2018
Merged

Fix memory leaks #9

merged 1 commit into from
Aug 15, 2018

Conversation

ianyfan
Copy link
Contributor

@ianyfan ianyfan commented Aug 15, 2018

No description provided.

main.c Outdated
@@ -144,6 +145,8 @@ static void seat_handle_capabilities(void *data, struct wl_seat *seat,
struct wl_pointer *wl_pointer = wl_seat_get_pointer(seat);
create_pointer(state, wl_pointer);
}

wl_seat_destroy(seat);
Copy link
Owner

Choose a reason for hiding this comment

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

Unfortunately I don't think we can do this. This function is called whenever seat capabilities change, this can happen at runtime (when you hotplug a mouse/keyboard for instance).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, my bad. Maybe keep a reference of it in the state and destroy it on exit then?

Copy link
Owner

Choose a reason for hiding this comment

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

There is no guarantee that there will be only one seat

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A list then? Or do you just want to leave it for now? I can remove the line from my patch.

Copy link
Owner

Choose a reason for hiding this comment

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

Yeah, a list with all the burden that comes with it: adding a new struct and allocating list elements.

This can be done in another PR if you prefer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Splitting it into another PR sounds like a good idea to me.

@emersion emersion merged commit 57bae56 into emersion:master Aug 15, 2018
@emersion
Copy link
Owner

Thanks!

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.

2 participants