Bug #76278 Modeling: Workbench crashes when right-clicking in empty table row
Submitted: 12 Mar 2015 8:34 Modified: 19 Mar 2015 7:26
Reporter: Frank Langner Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: Modeling Severity:S3 (Non-critical)
Version:6.2.4, 6.2.5, 6.3.1 OS:Microsoft Windows (8.1 Pro, 64Bit)
Assigned to: CPU Architecture:Any

[12 Mar 2015 8:34] Frank Langner
Description:
Hello,

Whenever you edit a Table in an EER-Model, select the Insert-Tab and try to open the context menu on a field in an empty line with an right click, the MySQL Workbench crashes. Debugging it with Visual Studio indicated, that an AccessViloationException had occurred. Stack trace:

[Managed to Native Transition]	
>	wbpublic.wr.dll!MySQL.Grt.Db.RecordsetWrapper.get_context_menu(System.Collections.Generic.List<int> indexes, int clicked_column) + 0x47 bytes	
 	sqlide.fe.dll!MySQL.Grt.Db.RecordsetView.gridView_CellContextMenuStripNeeded(object sender, System.Windows.Forms.DataGridViewCellContextMenuStripNeededEventArgs e) + 0x93 bytes	
 	System.Windows.Forms.dll!System.Windows.Forms.DataGridView.OnCellContextMenuStripNeeded(int columnIndex, int rowIndex, System.Windows.Forms.ContextMenuStrip contextMenuStrip) + 0x56 bytes	
 	System.Windows.Forms.dll!System.Windows.Forms.DataGridViewCell.GetContextMenuStrip(int rowIndex) + 0xb1 bytes	
 	System.Windows.Forms.dll!System.Windows.Forms.DataGridViewCell.GetInheritedContextMenuStrip(int rowIndex) + 0x62 bytes	
 	System.Windows.Forms.dll!System.Windows.Forms.DataGridView.WmContextMenu(ref System.Windows.Forms.Message m) + 0x225 bytes	
 	System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) + 0x70f bytes	
 	System.Windows.Forms.dll!System.Windows.Forms.DataGridView.WndProc(ref System.Windows.Forms.Message m) + 0x134 bytes	
 	System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.Callback(System.IntPtr hWnd, int msg, System.IntPtr wparam, System.IntPtr lparam) + 0x153 bytes	
 	[Native to Managed Transition]	
 	[Managed to Native Transition]	
 	System.Windows.Forms.dll!System.Windows.Forms.Control.SendMessage(int msg, System.IntPtr wparam, System.IntPtr lparam) + 0x68 bytes	
 	System.Windows.Forms.dll!System.Windows.Forms.Control.WmMouseUp(ref System.Windows.Forms.Message m, System.Windows.Forms.MouseButtons button, int clicks) + 0x12e bytes	
 	System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) + 0xeac bytes	
 	System.Windows.Forms.dll!System.Windows.Forms.DataGridView.WndProc(ref System.Windows.Forms.Message m) + 0x134 bytes	
 	System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.Callback(System.IntPtr hWnd, int msg, System.IntPtr wparam, System.IntPtr lparam) + 0x153 bytes	
 	[Native to Managed Transition]	
 	[Managed to Native Transition]	
 	System.Windows.Forms.dll!System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(System.IntPtr dwComponentID, int reason, int pvLoopData) + 0x681 bytes	
 	System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(int reason, System.Windows.Forms.ApplicationContext context) + 0x56f bytes	
 	System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoop(int reason, System.Windows.Forms.ApplicationContext context) + 0x6f bytes	
 	MySQLWorkbench.exe!MySQL.GUI.Workbench.Program.Main(string[] Args) + 0x108a bytes	

How to repeat:
- Open an EER-Diagram, or create a new one and insert a table with at least one column
- Right click that table and choose edit
- Switch to the Insert-Tab
- Right click a cell in an empty row
- Workbench crashes

Note: This bug does not occur, if a cell has the focus and an active cursor

Suggested fix:
Workbench should not crash.
[12 Mar 2015 9:23] Umesh Shastry
Hello Frank Langner,

Thank you for the report and repeatable test case.
Observed this on Win7 with WB 6.2.5.

Thanks,
Umesh
[12 Mar 2015 9:31] Umesh Shastry
// with 6.2.5

D:\Workbench\MySQL Workbench 6.2.5 (winx64)>MySQLWorkbench.exe -v -log-level=3

D:\Workbench\MySQL Workbench 6.2.5 (winx64)>
Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indi
cation that other memory is corrupt.
   at Recordset.update_selection_for_menu(Recordset* , vector<int\,std::allocator<int> >* , Int32 )
   at MySQL.Grt.Db.RecordsetWrapper.get_context_menu(List`1 indexes, Int32 clicked_column)
   at MySQL.Grt.Db.RecordsetView.gridView_CellContextMenuStripNeeded(Object sender, DataGridViewCellContextMenuStripNeed
edEventArgs e)
   at System.Windows.Forms.DataGridView.OnCellContextMenuStripNeeded(Int32 columnIndex, Int32 rowIndex, ContextMenuStrip
 contextMenuStrip)
   at System.Windows.Forms.DataGridViewCell.GetContextMenuStrip(Int32 rowIndex)
   at System.Windows.Forms.DataGridViewCell.GetInheritedContextMenuStrip(Int32 rowIndex)
   at System.Windows.Forms.DataGridView.WmContextMenu(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.DataGridView.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
[12 Mar 2015 9:35] Umesh Shastry
// 6.3.1

D:\Workbench\MySQL Workbench 6.3.1 CE (winx64)>
Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indi
cation that other memory is corrupt.
   at Recordset.update_selection_for_menu(Recordset* , vector<int\,std::allocator<int> >* , Int32 )
   at MySQL.Grt.Db.RecordsetWrapper.get_context_menu(List`1 indexes, Int32 clicked_column)
   at MySQL.Grt.Db.RecordsetView.gridView_CellContextMenuStripNeeded(Object sender, DataGridViewCellContextMenuStripNeed
edEventArgs e)
   at System.Windows.Forms.DataGridView.OnCellContextMenuStripNeeded(Int32 columnIndex, Int32 rowIndex, ContextMenuStrip
 contextMenuStrip)
   at System.Windows.Forms.DataGridViewCell.GetContextMenuStrip(Int32 rowIndex)
   at System.Windows.Forms.DataGridViewCell.GetInheritedContextMenuStrip(Int32 rowIndex)
   at System.Windows.Forms.DataGridView.WmContextMenu(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.DataGridView.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
[19 Mar 2015 7:26] Philip Olson
Posted by developer:
 
Fixed as of the upcoming MySQL Workbench 6.3.3 release, and here's the changelog entry:

Right-clicking on an out-of-focus empty field under the "Inserts editor"
in the EER modeling table editor would crash MySQL Workbench.

Thank you for the bug report.