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

Regen with nullable callbacks #230

Conversation

@GuillaumeGomez
Copy link
Member

GuillaumeGomez commented Jul 20, 2019

Requires gtk-rs/gir#815.

@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Jul 20, 2019

pid_callback: Option<&mut dyn (FnMut(&DesktopAppInfo, glib::Pid))>,
stdin_fd: i32,
stdout_fd: i32,
stderr_fd: i32,

This comment has been minimized.

Copy link
@sdroege

sdroege Jul 21, 2019

Member

This should be generic over FromRawFd for the fds on UNIX and FromRawHandle on Windows. Like we do elsewhere.

Passing arbitrary numbers around as fds is unsafe.

@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Jul 21, 2019

Looks good otherwise

@GuillaumeGomez GuillaumeGomez force-pushed the GuillaumeGomez:regen-with-nullable-callbacks branch from b77d12b to 7aa83c7 Jul 22, 2019
@GuillaumeGomez GuillaumeGomez force-pushed the GuillaumeGomez:regen-with-nullable-callbacks branch from 7aa83c7 to 1e10059 Jul 22, 2019
@GuillaumeGomez GuillaumeGomez force-pushed the GuillaumeGomez:regen-with-nullable-callbacks branch from 1e10059 to 2b16006 Oct 19, 2019
uris: &[&str],
launch_context: Option<&P>,
spawn_flags: glib::SpawnFlags,
user_setup: Option<Box_<dyn FnOnce() + 'static>>,

This comment has been minimized.

Copy link
@sdroege

sdroege Oct 20, 2019

Member

Not sure this is correct or safe. The function is called once per process, so if you have multiple URIs... :) OTOH this is called right after fork() from what I understand. Unclear if FnOnce is correct in this case.

This comment has been minimized.

Copy link
@sdroege

sdroege Oct 24, 2019

Member

What do you think?

This comment has been minimized.

Copy link
@sdroege

sdroege Oct 24, 2019

Member

Also unclear if Rust is supposed to be fork-safe, or if the closure needs to be marked unsafe anyway

pid_callback: Option<&mut dyn (FnMut(&DesktopAppInfo, glib::Pid))>,
stdin_fd: FD,
stdout_fd: FD,
stderr_fd: FD,

This comment has been minimized.

Copy link
@sdroege

sdroege Oct 20, 2019

Member

This should become a generic function with FD: IntoRawFd, or be marked as unsafe

This comment has been minimized.

Copy link
@GuillaumeGomez

GuillaumeGomez Oct 20, 2019

Author Member

Why IntoRawFd and not AsRawFd?

This comment has been minimized.

Copy link
@sdroege

sdroege Oct 23, 2019

Member

You give ownership of the fds to the function or not?

This comment has been minimized.

Copy link
@GuillaumeGomez

GuillaumeGomez Oct 23, 2019

Author Member

I wouldn't, that's why I pcked As* instead of Into*.

This comment has been minimized.

Copy link
@sdroege

sdroege Oct 23, 2019

Member

It doesn't matter what you would do :P What does the C function do?

This comment has been minimized.

Copy link
@GuillaumeGomez

GuillaumeGomez Oct 23, 2019

Author Member

It appears that the FDs need to be closed outside of the function: https://github.com/GNOME/gnome-shell/blob/master/src/shell-app.c#L1322

Therefore, we don't give ownership.

This comment has been minimized.

Copy link
@sdroege

sdroege Oct 23, 2019

Member

Then you're right :)

@GuillaumeGomez GuillaumeGomez force-pushed the GuillaumeGomez:regen-with-nullable-callbacks branch 3 times, most recently from a714d79 to 6ec1700 Oct 23, 2019
@GuillaumeGomez GuillaumeGomez force-pushed the GuillaumeGomez:regen-with-nullable-callbacks branch from 6ec1700 to ef1e34f Oct 23, 2019
@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Nov 2, 2019

This is obsolete now?

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented Nov 2, 2019

I guess?

@GuillaumeGomez GuillaumeGomez deleted the GuillaumeGomez:regen-with-nullable-callbacks branch Nov 2, 2019
@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented Nov 2, 2019

Wait actually it wasn't: it added new objects. Well, let's first merge your regen PR, it'll make less noise.

@GuillaumeGomez GuillaumeGomez referenced this pull request Nov 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.