Fix endless loop/crash after resetting layout

This commit is contained in:
Jonathan Jenne 2022-07-27 09:31:44 +02:00
parent dc9ed0887d
commit 6e9b190f00
2 changed files with 14 additions and 8 deletions

View File

@ -64,6 +64,11 @@ Public Class RefreshHelper
Private Function FindParentRowHandle(pRowInfo As RowInfo, oRowHandle As Integer) As Integer
Dim oParentRowHandle As Integer = _View.GetParentRowHandle(oRowHandle)
' Fixes endless loop when parent row handle is below zero
If oParentRowHandle < 0 Then
Return oParentRowHandle
End If
Do While _View.GetRowLevel(oParentRowHandle) <> pRowInfo.Level
oParentRowHandle = _View.GetParentRowHandle(oParentRowHandle)
Loop

View File

@ -671,7 +671,9 @@ Public Class frmMain
End Try
Try
If GridViewWFItems.Columns.ColumnByFieldName("ROW_COLOR") IsNot Nothing Then
GridViewWFItems.Columns.Item("ROW_COLOR").Visible = False
End If
Catch ex As Exception
End Try
@ -2072,9 +2074,7 @@ Public Class frmMain
End If
End Sub
Private Async Sub GridLayout_Reset()
Private Async Function GridLayout_Reset() As Tasks.Task
FRONTEND_ACTION = "RESET_LAYOUT"
Await Reset_GridLayout(False)
Await Decide_Load(False, True)
@ -2082,7 +2082,8 @@ Public Class frmMain
GridBuilder.WithFontSizeDelta(CONFIG.Config.GridFontSizeDelta)
If GridControl_Docs.Visible = True And FormOpenClose = False Then RefreshHelper.LoadViewInfo()
FRONTEND_ACTION = FA_NONE
End Sub
End Function
Async Function Reset_GridLayout(FormLoad As Boolean) As Tasks.Task
If GridControl_Docs.Visible = True And FormOpenClose = False Then
@ -2875,9 +2876,9 @@ Public Class frmMain
FRONTEND_ACTION = FA_NONE
End Sub
Private Sub BarButtonItem3_ItemClick_2(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem3.ItemClick
GridLayout_Reset()
End Sub
Private Async Function BarButtonItem3_ItemClick_2(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) As Tasks.Task Handles BarButtonItem3.ItemClick
Await GridLayout_Reset()
End Function
Private Sub BarButtonItem5_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemExportExcel.ItemClick
Grid_Export()