@@ -1332,8 +1332,9 @@ private void OnSelectionChangedTriggerSignal (object sender, EventArgs e)
13321332 {
13331333 if ( IsMultiFile )
13341334 {
1335- MethodInvoker invoker = DisplayCurrentFileOnStatusline ;
1336- _ = invoker . BeginInvoke ( null , null ) ;
1335+ //MethodInvoker invoker = DisplayCurrentFileOnStatusline;
1336+ _ = Task . Run ( DisplayCurrentFileOnStatusline ) ;
1337+ //_ = invoker.BeginInvoke(null, null);
13371338 }
13381339 else
13391340 {
@@ -2936,12 +2937,12 @@ private void LoadingFinished ()
29362937 private void LogEventWorker ( )
29372938 {
29382939 Thread . CurrentThread . Name = "LogEventWorker" ;
2939- while ( true )
2940+ while ( ! cts . Token . IsCancellationRequested )
29402941 {
29412942 //_logger.Debug($"Waiting for signal");
29422943 _ = _logEventArgsEvent . WaitOne ( ) ;
29432944 //_logger.Debug($"Wakeup signal received.");
2944- while ( true )
2945+ while ( ! cts . Token . IsCancellationRequested )
29452946 {
29462947 LogEventArgs e ;
29472948 //var lastLineCount = 0;
@@ -2973,9 +2974,24 @@ private void LogEventWorker ()
29732974 // }
29742975 //}
29752976
2976- _ = Invoke ( UpdateGrid , [ e ] ) ;
2977- CheckFilterAndHighlight ( e ) ;
2978- _timeSpreadCalc . SetLineCount ( e . LineCount ) ;
2977+ if ( IsDisposed || Disposing || _waitingForClose )
2978+ {
2979+ return ;
2980+ }
2981+ else
2982+ {
2983+ try
2984+ {
2985+ _ = Invoke ( UpdateGrid , [ e ] ) ;
2986+ }
2987+ catch ( ObjectDisposedException )
2988+ {
2989+ return ;
2990+ }
2991+
2992+ CheckFilterAndHighlight ( e ) ;
2993+ _timeSpreadCalc . SetLineCount ( e . LineCount ) ;
2994+ }
29792995 }
29802996 }
29812997 }
@@ -3132,8 +3148,7 @@ private void CheckFilterAndHighlight (LogEventArgs e)
31323148 var ( suppressLed , stopTail , setBookmark , bookmarkComment ) = GetHighlightActions ( matchingList ) ;
31333149 if ( setBookmark )
31343150 {
3135- SetBookmarkFx fx = SetBookmarkFromTrigger ;
3136- _ = fx . BeginInvoke ( i , bookmarkComment , null , null ) ;
3151+ _ = Task . Run ( ( ) => SetBookmarkFromTrigger ( i , bookmarkComment ) ) ;
31373152 }
31383153
31393154 if ( stopTail && _guiStateArgs . FollowTail )
@@ -3142,7 +3157,8 @@ private void CheckFilterAndHighlight (LogEventArgs e)
31423157 FollowTailChanged ( false , true ) ;
31433158 if ( firstStopTail && wasFollow )
31443159 {
3145- _ = Invoke ( new SelectLineFx ( SelectAndEnsureVisible ) , [ i , false ] ) ;
3160+ //_ = Invoke(new SelectLineFx(SelectAndEnsureVisible), [i, false]);
3161+ _ = Task . Run ( ( ) => SelectAndEnsureVisible ( i , false ) ) ;
31463162 firstStopTail = false ;
31473163 }
31483164 }
@@ -3180,8 +3196,9 @@ private void CheckFilterAndHighlight (LogEventArgs e)
31803196 var ( suppressLed , stopTail , setBookmark , bookmarkComment ) = GetHighlightActions ( matchingList ) ;
31813197 if ( setBookmark )
31823198 {
3183- SetBookmarkFx fx = SetBookmarkFromTrigger ;
3184- _ = fx . BeginInvoke ( i , bookmarkComment , null , null ) ;
3199+ //SetBookmarkFx fx = SetBookmarkFromTrigger;
3200+ _ = Task . Run ( ( ) => SetBookmarkFromTrigger ( i , bookmarkComment ) ) ;
3201+ //_ = fx.BeginInvoke(i, bookmarkComment, null, null);
31853202 }
31863203
31873204 if ( stopTail && _guiStateArgs . FollowTail )
@@ -3190,7 +3207,8 @@ private void CheckFilterAndHighlight (LogEventArgs e)
31903207 FollowTailChanged ( false , true ) ;
31913208 if ( firstStopTail && wasFollow )
31923209 {
3193- _ = Invoke ( new SelectLineFx ( SelectAndEnsureVisible ) , [ i , false ] ) ;
3210+ //_ = Invoke(new SelectLineFx(SelectAndEnsureVisible), [i, false]);
3211+ _ = Task . Run ( ( ) => SelectAndEnsureVisible ( i , false ) ) ;
31943212 firstStopTail = false ;
31953213 }
31963214 }
@@ -3223,8 +3241,9 @@ private void LaunchHighlightPlugins (IList<HighlightEntry> matchingList, int lin
32233241 var plugin = PluginRegistry . PluginRegistry . Instance . FindKeywordActionPluginByName ( entry . ActionEntry . PluginName ) ;
32243242 if ( plugin != null )
32253243 {
3226- ActionPluginExecuteFx fx = plugin . Execute ;
3227- _ = fx . BeginInvoke ( entry . SearchText , entry . ActionEntry . ActionParam , callback , CurrentColumnizer , null , null ) ;
3244+ //ActionPluginExecuteFx fx = plugin.Execute;
3245+ _ = Task . Run ( ( ) => plugin . Execute ( entry . SearchText , entry . ActionEntry . ActionParam , callback , CurrentColumnizer ) ) ;
3246+ //_ = fx.BeginInvoke(entry.SearchText, entry.ActionEntry.ActionParam, callback, CurrentColumnizer, null, null);
32283247 }
32293248 }
32303249 }
@@ -4359,11 +4378,8 @@ private async void FilterSearch (string text)
43594378
43604379 var settings = ConfigManager . Settings ;
43614380
4362- //FilterFx fx = settings.preferences.multiThreadFilter ? MultiThreadedFilter : new FilterFx(Filter);
43634381 FilterFxAction = settings . Preferences . MultiThreadFilter ? MultiThreadedFilter : Filter ;
4364-
4365- //Task.Run(() => fx.Invoke(_filterParams, _filterResultList, _lastFilterLinesList, _filterHitList));
4366- var filterFxActionTask = Task . Run ( ( ) => Filter ( _filterParams , _filterResultList , _lastFilterLinesList , _filterHitList ) ) . ConfigureAwait ( false ) ;
4382+ var filterFxActionTask = Task . Run ( ( ) => FilterFxAction ( _filterParams , _filterResultList , _lastFilterLinesList , _filterHitList ) ) . ConfigureAwait ( false ) ;
43674383
43684384 await filterFxActionTask ;
43694385 FilterComplete ( ) ;
@@ -4388,7 +4404,7 @@ private void MultiThreadedFilter (FilterParams filterParams, List<int> filterRes
43884404 OnRegisterCancelHandler ( cancelHandler ) ;
43894405 long startTime = Environment . TickCount ;
43904406
4391- fs . DoFilter ( filterParams , 0 , _logFileReader . LineCount , FilterProgressCallback ) ;
4407+ fs . DoFilter ( filterParams , 0 , _logFileReader . LineCount , FilterProgressCallback ) . GetAwaiter ( ) . GetResult ( ) ;
43924408
43934409 long endTime = Environment . TickCount ;
43944410
@@ -6609,7 +6625,7 @@ public IList<HighlightMatchEntry> FindHighlightMatches (ITextValueMemory line)
66096625 GetHighlightEntryMatches ( line , _currentHighlightGroup . HighlightEntryList , resultList ) ;
66106626 }
66116627
6612- lock ( _tempHighlightEntryList )
6628+ lock ( _tempHighlightEntryListLock )
66136629 {
66146630 GetHighlightEntryMatches ( line , _tempHighlightEntryList , resultList ) ;
66156631 }
@@ -7751,8 +7767,9 @@ public void PatternStatisticSelectRange (PatternArgs patternArgs)
77517767
77527768 public void PatternStatistic ( PatternArgs patternArgs )
77537769 {
7754- var fx = new PatternStatisticFx ( TestStatistic ) ;
7755- _ = fx . BeginInvoke ( patternArgs , null , null ) ;
7770+ //var fx = new PatternStatisticFx(TestStatistic);
7771+ _ = Task . Run ( ( ) => TestStatistic ( patternArgs ) ) ;
7772+ //_ = fx.BeginInvoke(patternArgs, null, null);
77567773 }
77577774
77587775 public void ExportBookmarkList ( )
0 commit comments