diff --git a/V2RayX/AdvancedWindowController.m b/V2RayX/AdvancedWindowController.m
index e512248..863f313 100644
--- a/V2RayX/AdvancedWindowController.m
+++ b/V2RayX/AdvancedWindowController.m
@@ -31,6 +31,12 @@ - (instancetype)initWithWindowNibName:(NSNibName)windowNibName parentController:
return self;
}
+- (void)removeObservers {
+ [self removeObserver:self forKeyPath:@"selectedOutbound"];
+ [self removeObserver:self forKeyPath:@"selectedRuleSet"];
+ [self removeObserver:self forKeyPath:@"selectedRule"];
+}
+
- (void)windowDidLoad {
[super windowDidLoad];
@@ -67,7 +73,7 @@ - (void)windowDidLoad {
forKeyPath:@"selectedRule"
options:NSKeyValueObservingOptionNew
context:nil];
-// [self addObserver:self forKeyPath:@"ruleSetNameField.stringValue" options:NSKeyValueObservingOptionNew context:nil];
+
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(textFieldDidChange:)
name:NSControlTextDidChangeNotification
@@ -122,11 +128,12 @@ - (IBAction)ok:(id)sender {
}
[self textDidEndEditing:
[[NSNotification alloc] initWithName:NSTextDidEndEditingNotification object:_domainIpTextView userInfo:nil]];
-
+ [self removeObservers];
[self.window.sheetParent endSheet:self.window returnCode:NSModalResponseOK];
}
- (IBAction)cancel:(id)sender {
+ [self removeObservers];
[self.window.sheetParent endSheet:self.window returnCode:NSModalResponseCancel];
}
diff --git a/V2RayX/ConfigWindow.xib b/V2RayX/ConfigWindow.xib
index 11e06f5..d528711 100644
--- a/V2RayX/ConfigWindow.xib
+++ b/V2RayX/ConfigWindow.xib
@@ -517,7 +517,7 @@
-
+