Compare commits

..

1 Commits

Author SHA1 Message Date
chen08209
fd1dfe5c60 Fix Tab destroy error 2024-05-06 19:05:27 +08:00
6 changed files with 19 additions and 26 deletions

View File

@@ -175,10 +175,8 @@ func patchConfig(general *config.General) {
const concurrentCount = math.MaxInt
var wg = sync.WaitGroup{}
var exit = make(chan struct{})
func hcCompatibleProvider(proxyProviders map[string]provider.ProxyProvider) {
wg := sync.WaitGroup{}
ch := make(chan struct{}, concurrentCount)
for _, proxyProvider := range proxyProviders {
proxyProvider := proxyProvider
@@ -186,11 +184,6 @@ func hcCompatibleProvider(proxyProviders map[string]provider.ProxyProvider) {
log.Infoln("Start initial Compatible provider %s", proxyProvider.Name())
wg.Add(1)
ch <- struct{}{}
select {
case <-exit:
return // 收到退出信号,退出协程
default:
}
go func() {
defer func() { <-ch; wg.Done() }()
if err := proxyProvider.Initial(); err != nil {
@@ -202,13 +195,6 @@ func hcCompatibleProvider(proxyProviders map[string]provider.ProxyProvider) {
}
}
func cancelHc() {
close(exit)
wg.Wait()
exit = make(chan struct{})
wg = sync.WaitGroup{}
}
func applyConfig(isPatch bool) {
cfg, err := config.ParseRawConfig(currentConfig)
if err != nil {

View File

@@ -236,6 +236,7 @@ class AppController {
}
healthcheck() {
if (globalState.healthcheckLock) return;
for (final delay in appState.delayMap.entries) {
setDelay(
Delay(

View File

@@ -83,12 +83,15 @@ class _ProxiesFragmentState extends State<ProxiesFragment>
groupNames: groupNames,
);
},
builder: (_, state, __) {
if (_tabController != null) {
_tabController!.dispose();
_tabController = null;
shouldRebuild: (prev,next){
if(prev.groupNames.length != next.groupNames.length){
_tabController?.dispose();
_tabController =null;
}
_tabController = TabController(
return prev != next;
},
builder: (_, state, __) {
_tabController ??= TabController(
length: state.groupNames.length,
vsync: this,
initialIndex: state.currentIndex,
@@ -118,7 +121,6 @@ class _ProxiesFragmentState extends State<ProxiesFragment>
children: [
for (final groupName in state.groupNames)
KeepContainer(
key: ObjectKey(groupName),
child: ProxiesTabView(
groupName: groupName,
),

View File

@@ -23,6 +23,7 @@ class GlobalState {
List<Function> updateFunctionLists = [];
List<NavigationItem> currentNavigationItems = [];
bool updatePackagesLock = false;
bool healthcheckLock = false;
startListenUpdate() {
if (timer != null && timer!.isActive == true) return;

View File

@@ -38,12 +38,15 @@ class _ClashMessageContainerState extends State<ClashMessageContainer>
@override
void onDelay(Delay delay) {
context.appController.setDelay(delay);
final appController = context.appController;
appController.setDelay(delay);
globalState.healthcheckLock = true;
WidgetsBinding.instance.addPostFrameCallback((_) {
globalState.updateSortNumDebounce ??= debounce<Function()>(
() {
context.appController.updateGroups();
context.appController.appState.sortNum++;
() async {
await appController.updateGroups();
appController.appState.sortNum++;
globalState.healthcheckLock = false;
},
milliseconds: 5000,
);

View File

@@ -1,7 +1,7 @@
name: fl_clash
description: A multi-platform proxy client based on ClashMeta, simple and easy to use, open-source and ad-free.
publish_to: 'none'
version: 0.7.12
version: 0.7.13
environment:
sdk: '>=3.1.0 <4.0.0'