XQuartz: Controller thread launches clients
This avoids a memory leak due to no active auto-release pool on the server thread.
Signed-off-by: Jeremy Huddleston <jeremyhu@freedesktop.org>
(cherry picked from commit 6d6e8fb27f
)
This commit is contained in:
parent
2d55b842b8
commit
dfb0c50294
|
@ -71,6 +71,7 @@ void X11ApplicationSetFrontProcess (void);
|
|||
void X11ApplicationSetCanQuit (int state);
|
||||
void X11ApplicationServerReady (void);
|
||||
void X11ApplicationShowHideMenubar (int state);
|
||||
void X11ApplicationLaunchClient (const char *cmd);
|
||||
|
||||
void X11ApplicationMain(int argc, char **argv, char **envp);
|
||||
|
||||
|
|
|
@ -411,6 +411,9 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
|
|||
SetSystemUIMode(kUIModeAllHidden, quartzFullscreenMenu ? kUIOptionAutoShowMenuBar : 0); // kUIModeAllSuppressed or kUIOptionAutoShowMenuBar can be used to allow "mouse-activation"
|
||||
}
|
||||
|
||||
- (void) launch_client:(NSString *)cmd {
|
||||
(void)[_controller application:self openFile:cmd];
|
||||
}
|
||||
|
||||
/* user preferences */
|
||||
|
||||
|
@ -856,6 +859,16 @@ void X11ApplicationShowHideMenubar (int state) {
|
|||
[n release];
|
||||
}
|
||||
|
||||
void X11ApplicationLaunchClient (const char *cmd) {
|
||||
NSString *string;
|
||||
|
||||
string = [[NSString alloc] initWithUTF8String:cmd];
|
||||
|
||||
message_kit_thread (@selector (launch_client:), string);
|
||||
|
||||
[string release];
|
||||
}
|
||||
|
||||
static void check_xinitrc (void) {
|
||||
char *tem, buf[1024];
|
||||
NSString *msg;
|
||||
|
@ -961,12 +974,6 @@ void X11ApplicationMain (int argc, char **argv, char **envp) {
|
|||
/* not reached */
|
||||
}
|
||||
|
||||
void launch_client(const char *cmd) {
|
||||
NSString *string = [[NSString alloc] initWithUTF8String:cmd];
|
||||
[[X11App controller] launch_client:string];
|
||||
[string release];
|
||||
}
|
||||
|
||||
@implementation X11Application (Private)
|
||||
|
||||
#ifdef NX_DEVICELCMDKEYMASK
|
||||
|
|
|
@ -120,6 +120,7 @@ typedef unsigned int NSUInteger;
|
|||
#endif
|
||||
- (void) set_can_quit:(OSX_BOOL)state;
|
||||
- (void) server_ready;
|
||||
- (OSX_BOOL) application:(NSApplication *)app openFile:(NSString *)filename;
|
||||
|
||||
- (IBAction) apps_table_show:(id)sender;
|
||||
- (IBAction) apps_table_done:(id)sender;
|
||||
|
@ -144,6 +145,5 @@ typedef unsigned int NSUInteger;
|
|||
#endif /* __OBJC__ */
|
||||
|
||||
void X11ControllerMain(int argc, char **argv, char **envp);
|
||||
void launch_client(const char *cmd);
|
||||
|
||||
#endif /* X11CONTROLLER_H */
|
||||
|
|
|
@ -408,7 +408,7 @@ void DarwinKeyboardReloadHandler(void) {
|
|||
if (access(xmodmap, F_OK) == 0) {
|
||||
if (access(sysmodmap, F_OK) == 0) {
|
||||
snprintf (cmd, sizeof(cmd), "%s %s", xmodmap, sysmodmap);
|
||||
launch_client(cmd);
|
||||
X11ApplicationLaunchClient(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -417,7 +417,7 @@ void DarwinKeyboardReloadHandler(void) {
|
|||
snprintf (usermodmap, sizeof(usermodmap), "%s/.Xmodmap", homedir);
|
||||
if (access(usermodmap, F_OK) == 0) {
|
||||
snprintf (cmd, sizeof(cmd), "%s %s", xmodmap, usermodmap);
|
||||
launch_client(cmd);
|
||||
X11ApplicationLaunchClient(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue