From c8cfc39c997ba3ca3e3a7c2f4ca750420243aca6 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Mon, 30 May 2011 17:21:25 +0000 Subject: [PATCH] Avoid AVs by referring to DBObject.Connection instead of MainForm.ActiveConnection, which is nil for milliseconds when the tree focused node changes. Fixes issue #2418. --- source/table_editor.pas | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/table_editor.pas b/source/table_editor.pas index aa4ed3b7..00821e78 100644 --- a/source/table_editor.pas +++ b/source/table_editor.pas @@ -256,9 +256,9 @@ var begin inherited; FLoaded := False; - comboEngine.Items := MainForm.ActiveConnection.TableEngines; - comboEngine.ItemIndex := comboEngine.Items.IndexOf(MainForm.ActiveConnection.TableEngineDefault); - comboCollation.Items := MainForm.ActiveConnection.CollationList; + comboEngine.Items := DBObject.Connection.TableEngines; + comboEngine.ItemIndex := comboEngine.Items.IndexOf(DBObject.Connection.TableEngineDefault); + comboCollation.Items := DBObject.Connection.CollationList; listColumns.BeginUpdate; FColumns.Clear; btnClearIndexesClick(Self); @@ -283,7 +283,7 @@ begin // Creating new table editName.Text := ''; if DBObject.Connection.Parameters.NetTypeGroup = ngMySQL then - comboCollation.ItemIndex := comboCollation.Items.IndexOf(MainForm.ActiveConnection.GetVar('SHOW VARIABLES LIKE ''collation_database''', 1)); + comboCollation.ItemIndex := comboCollation.Items.IndexOf(DBObject.Connection.GetVar('SHOW VARIABLES LIKE ''collation_database''', 1)); PageControlMain.ActivePage := tabBasic; end else begin // Editing existing table @@ -323,7 +323,7 @@ begin memoUnionTables.Lines.Clear; rx.Expression := '\bCOMMENT=''((.+)[^''])'''; if rx.Exec(DBObject.CreateCode) then - memoComment.Lines.Text := MainForm.ActiveConnection.UnescapeString(rx.Match[1]) + memoComment.Lines.Text := DBObject.Connection.UnescapeString(rx.Match[1]) else memoComment.Lines.Clear; DBObject.Connection.ParseTableStructure(DBObject.CreateCode, FColumns, FKeys, FForeignKeys); @@ -378,7 +378,7 @@ begin Batch := ComposeAlterStatement; try for Query in Batch do - MainForm.ActiveConnection.Query(Query.SQL); + DBObject.Connection.Query(Query.SQL); tabALTERcode.TabVisible := DBObject.Name <> ''; if chkCharsetConvert.Checked then begin // Autoadjust column collations