GNOME Bugzilla – Bug 579776
Close file descriptors on re-exec
Last modified: 2009-04-23 18:11:16 UTC
Use code copied from GLib to close all file descriptors before we reexec ourselves on the restart Alt-F2 command. This fixes serious memory leaks when we have mapped graphics buffers.
Created attachment 133073 [details] [review] Close file descriptors on re-exec
i confirm that you have successfully copied and pasted! :) as discussed on irc, i feel like it would be better to NOT copy and paste this, but we can revisit that later. (when we get to the point where gnome-shell is actually being started by gnome-session, we can just do the exit-and-let-gnome-session-restart-you trick)
Looks fine for now though (though I would add a space before parens in the call).
Committed as is (adding the space.) The approach of g_spawn() then quit the parent is probably better, but not enough better in my estimation to redo the patch. There might also be a little more potential for races with the spawn-and-quit approach. (Though there is a potential for races in the exec approach as well... the X server won't necessarily have seen the X fd closed before the child tries to claim the window manager selection.)
(In reply to comment #4) > (Though there is a potential for races in the exec approach as > well... the X server won't necessarily have seen the X fd closed before the > child tries to claim the window manager selection.) If that turns out to be a problem, we can just always pass --replace when re-exec'ing.