summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@freedesktop.org>2009-11-04 13:34:20 -0800
committerJeremy Huddleston <jeremyhu@freedesktop.org>2009-11-05 18:34:50 -0800
commit6d6e8fb27f00f0c3128cef624b39a60aa754fdc8 (patch)
treef186c5ec4ccc5eda2b84d5e384fcf1f0b7753f90
parentf7b375bd141d0cf1e3add5443a5838dd8f554ef6 (diff)
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>
-rw-r--r--hw/xquartz/X11Application.h1
-rw-r--r--hw/xquartz/X11Application.m19
-rw-r--r--hw/xquartz/X11Controller.h2
-rw-r--r--hw/xquartz/quartzKeyboard.c4
4 files changed, 17 insertions, 9 deletions
diff --git a/hw/xquartz/X11Application.h b/hw/xquartz/X11Application.h
index 5e828a440..d7e9a5fa5 100644
--- a/hw/xquartz/X11Application.h
+++ b/hw/xquartz/X11Application.h
@@ -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);
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 2c9548534..f3c8a307a 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -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
diff --git a/hw/xquartz/X11Controller.h b/hw/xquartz/X11Controller.h
index 3d8e007e7..88f50a1d7 100644
--- a/hw/xquartz/X11Controller.h
+++ b/hw/xquartz/X11Controller.h
@@ -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 */
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 5bbb9c9cf..1b3c27e91 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -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);
}
}
}