Make dialog sheet messages unsafe

This commit is contained in:
Bjorn Winckler
2009-04-08 20:41:32 +02:00
parent 40263195cb
commit 0413dcf3f1
2 changed files with 16 additions and 33 deletions
+2 -4
View File
@@ -20,8 +20,8 @@
@interface MMVimController : NSObject
{
@interface MMVimController : NSObject {
unsigned identifier;
BOOL isInitialized;
MMWindowController *windowController;
id backendProxy;
@@ -37,8 +37,6 @@
#endif
BOOL isPreloading;
NSDate *creationDate;
unsigned identifier;
}
- (id)initWithBackend:(id)backend pid:(int)processIdentifier;
+14 -29
View File
@@ -10,17 +10,20 @@
/*
* MMVimController
*
* Coordinates input/output to/from backend. Each MMBackend communicates
* directly with a MMVimController.
* Coordinates input/output to/from backend. A MMVimController sends input
* directly to a MMBackend, but communication from MMBackend to MMVimController
* goes via MMAppController so that it can coordinate all incoming distributed
* object messages.
*
* MMVimController does not deal with visual presentation. Essentially it
* should be able to run with no window present.
*
* Output from the backend is received in processInputQueue:. Input is sent
* to the backend via sendMessage:data: or addVimInput:. The latter allows
* execution of arbitrary strings in the Vim process, much like the Vim script
* function remote_send() does. The messages that may be passed between
* frontend and backend are defined in an enum in MacVim.h.
* Output from the backend is received in processInputQueue: (this message is
* called from MMAppController so it is not a DO call). Input is sent to the
* backend via sendMessage:data: or addVimInput:. The latter allows execution
* of arbitrary strings in the Vim process, much like the Vim script function
* remote_send() does. The messages that may be passed between frontend and
* backend are defined in an enum in MacVim.h.
*/
#import "MMAppController.h"
@@ -49,10 +52,10 @@ static NSTimeInterval MMBackendProxyRequestTimeout = 0;
// Timeout used for setDialogReturn:.
static NSTimeInterval MMSetDialogReturnTimeout = 1.0;
static BOOL isUnsafeMessage(int msgid);
static unsigned identifierCounter = 1;
static BOOL isUnsafeMessage(int msgid);
@interface MMAlert : NSAlert {
NSTextField *textField;
@@ -1251,16 +1254,6 @@ static unsigned identifierCounter = 1;
{
if (!isInitialized) return;
BOOL inDefaultMode = [[[NSRunLoop currentRunLoop] currentMode]
isEqual:NSDefaultRunLoopMode];
if (!inDefaultMode) {
// Delay call until run loop is in default mode.
[self performSelector:@selector(handleBrowseForFile:)
withObject:attr
afterDelay:0];
return;
}
NSString *dir = [attr objectForKey:@"dir"];
BOOL saving = [[attr objectForKey:@"saving"] boolValue];
@@ -1296,16 +1289,6 @@ static unsigned identifierCounter = 1;
{
if (!isInitialized) return;
BOOL inDefaultMode = [[[NSRunLoop currentRunLoop] currentMode]
isEqual:NSDefaultRunLoopMode];
if (!inDefaultMode) {
// Delay call until run loop is in default mode.
[self performSelector:@selector(handleShowDialog:)
withObject:attr
afterDelay:0];
return;
}
NSArray *buttonTitles = [attr objectForKey:@"buttonTitles"];
if (!(buttonTitles && [buttonTitles count])) return;
@@ -1467,6 +1450,8 @@ isUnsafeMessage(int msgid)
EnterFullscreenMsgID, // Modifies delegate of window controller
LeaveFullscreenMsgID, // Modifies delegate of window controller
CloseWindowMsgID, // See note below
BrowseForFileMsgID, // Enters modal loop
ShowDialogMsgID, // Enters modal loop
};
// NOTE about CloseWindowMsgID: If this arrives at the same time as say