Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Commit 34a825c

Browse files
committed
fix #200, #202
1 parent a2eab8c commit 34a825c

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

V2RayX/AdvancedWindowController.m

+9-2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ - (instancetype)initWithWindowNibName:(NSNibName)windowNibName parentController:
3131
return self;
3232
}
3333

34+
- (void)removeObservers {
35+
[self removeObserver:self forKeyPath:@"selectedOutbound"];
36+
[self removeObserver:self forKeyPath:@"selectedRuleSet"];
37+
[self removeObserver:self forKeyPath:@"selectedRule"];
38+
}
39+
3440
- (void)windowDidLoad {
3541
[super windowDidLoad];
3642

@@ -67,7 +73,7 @@ - (void)windowDidLoad {
6773
forKeyPath:@"selectedRule"
6874
options:NSKeyValueObservingOptionNew
6975
context:nil];
70-
// [self addObserver:self forKeyPath:@"ruleSetNameField.stringValue" options:NSKeyValueObservingOptionNew context:nil];
76+
7177
[[NSNotificationCenter defaultCenter] addObserver:self
7278
selector:@selector(textFieldDidChange:)
7379
name:NSControlTextDidChangeNotification
@@ -122,11 +128,12 @@ - (IBAction)ok:(id)sender {
122128
}
123129
[self textDidEndEditing:
124130
[[NSNotification alloc] initWithName:NSTextDidEndEditingNotification object:_domainIpTextView userInfo:nil]];
125-
131+
[self removeObservers];
126132
[self.window.sheetParent endSheet:self.window returnCode:NSModalResponseOK];
127133
}
128134

129135
- (IBAction)cancel:(id)sender {
136+
[self removeObservers];
130137
[self.window.sheetParent endSheet:self.window returnCode:NSModalResponseCancel];
131138
}
132139

V2RayX/ConfigWindow.xib

+1-1
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@
517517
<font key="font" metaFont="system"/>
518518
</buttonCell>
519519
<connections>
520-
<action selector="showAdvancedWindow:" target="-2" id="15k-Xq-IZU"/>
520+
<action selector="showAdvancedWindow:" target="-2" id="1El-Bd-DKf"/>
521521
</connections>
522522
</button>
523523
<button toolTip="Restart V2Ray and connected to the selected server above" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="fnz-Bw-lGu">

0 commit comments

Comments
 (0)