On 2022/03/21 18:14, Paolo Bonzini wrote:
On 3/19/22 14:56, Philippe Mathieu-Daudé wrote:
   1. Move setgid and setuid calls after [+NSApplication
   sharedApplication] to let NSApplication initialize as the original
   user.

Another possibility is to move the code up to "[QemuApplication sharedApplication]" from main() to cocoa_display_init().

Paolo

I'm for moving everything except [NSApp run] to cocoa_display_init().

This series moved Cocoa display initialization code to [-QemuCocoaApplicatinController applicationDidFinishLaunching:] to keep the initialization order for Cocoa, but it is unlikely that doing initialization things before [-QemuCocoaApplicatinController applicationDidFinishLaunching:] would cause problems. (The only Apple thing affected by the change would be dispatch_sync, which is rarely used.) The code movement is rather intrusive for QEMU as found with this "runas" problem.

Doing Cocoa initialization things in [-QemuCocoaApplicatinController applicationDidFinishLaunching:] and after the method call can be even dangerous as it would modify the state of Cocoa, which is already running. "Create menus in iothread" patch series actually triggered such a problem and required careful coding:
https://patchew.org/QEMU/20220321041043.24112-1-akihiko.od...@gmail.com/

The code movement also requires more code to keep the content of DisplayOptions and to have the definition of [-QemuCocoaApplicatinController applicationDidFinishLaunching:]. It would be simply nice if we could remove them.

Regards,
Akihiko Odaki

Reply via email to