TDM crashing on deletion of a View

With this script (partial):


    var tview = Model.Views.GetObjectByName(view_name);
    if (tview != null) {
       Log.Information('Deleting existing auto-gen view: '+view_name);
       Model.Lock();
       tview.Delete();
       Model.Unlock();
    }

TDM is crashing on the 2d or 3rd time it’s invoked. Prior to crashing it apparently does what I want it to do: delete the view identified by the GetObjectByName.

I have Model.Lock()/Unlock() simply based on other scripts I’ve seen around here, it isn’t 100% clear to me what that does. I added it to try to fix the problem, which happens without them.

This is part of the generated log when the crash occurs. I retained the parts that seem potentially relevant. (The OS is actually x64 Windows Server 2008R2, not Vista):

EurekaLog 6.0.14

Application:

1.1 Start Date : Tue, 23 Oct 2012 19:40:50 -0400
1.2 Name/Description: TDM.exe - (Toad Data Modeler)
1.3 Version Number : 4.3.3.6
1.4 Parameters :
1.5 Compilation Date: Thu, 30 Aug 2012 02:06:52 -0400
1.6 Up Time : 1 minute, 12 seconds

Exception:

2.1 Date : Tue, 23 Oct 2012 19:42:02 -0400
2.2 Address : 010BCC7C
2.3 Module Name : TDM.exe - (Toad Data Modeler)
2.4 Module Version: 4.3.3.6
2.5 Type : EAccessViolation
2.6 Message : Access violation at address 010BCC7C in module ‘TDM.exe’. Read of address 00000000.
2.7 ID : D445
2.8 Count : 1
2.9 Status : New
2.10 Note :

[…]

Operating System:

6.1 Type : Microsoft Windows Vista (64 bit)
6.2 Build # : 7601
6.3 Update : Service Pack 1
6.4 Language: English
6.5 Charset : 0

[…]

Call Stack Information:

|Address |Module |Unit |Class |Procedure/Method |Line |

*Exception Thread: ID=4316; Priority=-2; Class=; [Main]
010BCC7C
01313292
0131317C
00FF08FF
004EB60C
004EB484
004EE68B
004EE534
74BAED21
74BAED79
004EB484
004EE68B
004EE534
00EFE2DE
0132450F
0051FCB1
004EE308
76340D48
76340D32
0051F914
76337BC5
76337BBB
014775C4
01477418
0147A7BA
--------------------------------------------------------------------------------------------------------------------------
Running Thread: ID=2756; Priority=0; Class=TExplorerNotifierThread
--------------------------------------------------------------------------------------------------------------------------
74BB14E9
0078089D
--------------------------------------------------------------------------------------------------------------------------
Calling Thread: ID=4316; Priority=-2; Class=; [Main]
--------------------------------------------------------------------------------------------------------------------------
007807C1
00780720
00780569
00780530
0078092A
007808F4
00780999
00780639
00780624
00780529
00780524
011B96AD
011B67AF
01437523
014370F0
014774DF
01477418
0147A7BA
--------------------------------------------------------------------------------------------------------------------------
Running Thread: ID=2844; Priority=0; Class=TExplorerNotifierThread
--------------------------------------------------------------------------------------------------------------------------
74BB0DA7
74BB14E9
74BAC428
74BBA148
0078089D
--------------------------------------------------------------------------------------------------------------------------
Calling Thread: ID=4316; Priority=-2; Class=; [Main]
--------------------------------------------------------------------------------------------------------------------------
007807C1
00780720
00780569
00780530
0078092A
007808F4
007809C5
00780639
00780624
00780529
00780524
011B96AD
011B67AF
01437523
014370F0
014774DF
01477418
0147A7BA
--------------------------------------------------------------------------------------------------------------------------
Running Thread: ID=720; Priority=0; Class=TExplorerNotifierThread
--------------------------------------------------------------------------------------------------------------------------
74BB14E9
0078089D
--------------------------------------------------------------------------------------------------------------------------
Calling Thread: ID=4316; Priority=-2; Class=; [Main]
--------------------------------------------------------------------------------------------------------------------------
007807C1
00780720
00780569
00780530
0078092A
007808F4
013D7A28
00780639
00780624
00780529
00780524
013CF6C1
013D5F3E
013D5E88
01437623
014370F0
014774DF
01477418
0147A7BA
--------------------------------------------------------------------------------------------------------------------------
Running Thread: ID=4920; Priority=0; Class=TWorkerThread
--------------------------------------------------------------------------------------------------------------------------
74BB1405
--------------------------------------------------------------------------------------------------------------------------
Calling Thread: ID=4316; Priority=-2; Class=; [Main]
--------------------------------------------------------------------------------------------------------------------------
01011B10
00FFFFFB
004E95D9
004E95AC
004ECB31
004ECB0C
74BAED21
74BAED79
76341151
76341160
00533BE5
00533B44
013BA9BE
013BA960
0132DA99
0132DA7C
0073AF3A
0073AF24
0118EBBC
0118EB90
0118DC45
0118DC28
008326F9
01321A7F
013217D8
00F00627
00711C8F
00712060
00711FA4
0132316A
013230BC
00EFD116
00533C68
00533B44
013BA9BE
013BA960
01322E1C
01322DE0
00EFDD2D
01477566
01477418
0147A7BA

I guess I should add: if I’m doing something wrong in how I’m deleting the view, what’s the right way?

Hi,

this is the right way. Please refresh model by calling the Model.RefreshModel() method.

function main(){
var view_name = “View3”;
var tview = Model.Views.GetObjectByName(view_name);
if (tview != null)
{
Log.Information("Deleting existing auto-gen view: "+view_name);
tview.Delete();
Model.RefreshModel();
}
else
{
Log.Information("View “+view_name + " not found.”);
}
}

Regards,

Vaclav