Hi there guys... wondering if you can help figure out why I'm crashing Opus with this sample script. If you'd rather I dumb down the sample way more than it is now, I can... I originally pulled out all the functional stuff to produce this sample - but have since come to figure it's probably NOT a result of any of my passing things around between functions, and probably something either I'm doing wrong in how I'm assigning my values, or possibly a goofy issue with Opus' support for using Map objects as environment variables.
I've attached a zip archive with the following:
- Clipboard Image.png == screenshot of the crash notification
- dopus.20151213.141858.dmp == crash dump saved to /temp\DOpus.Minidumps
- vbTest.dcf == toolbar button to toggle script behavior ON/OFF
- vbTest.vbs == script
You should be able repro the crash by doing the following:
- Drop the toolbar button onto a toolbar
- open a dual display lister and set the source folder to a dir with a sub-dir that also contains at least one other sub-dir (parent dir\child dir 1\child dir 2)
- Drop the script into the Script AddIns folder
- From the "parent dir" toggle the script on using the toolbar button, you should get the following bit of output in the script log:
vbTest.vbs: Initializing...
vbTest: OnvbTest()
vbTest: ----------------------------------------------------------------
vbTest: vbTest: On
vbTest: vbTest_On()
vbTest: ----------------------------------------------------------------
vbTest: SOURCE TAB: STATS
vbTest: ----------------------------------------------------------------
vbTest: SrcTab-> ID: 8325124
vbTest: SrcTab-> CurrentPath: lib://My/Projects/opus/scripting/my.NavSync
vbTest: SrcTab-> LinkedTabID: 52299712
vbTest: SrcTab-> InitialPath: lib://My/Projects/opus/scripting/my.NavSync
vbTest: SrcTab-> LastPath: lib://My/Projects/opus/scripting/my.NavSync
vbTest: SrcTab-> SyncState: True
vbTest: ----------------------------------------------------------------
vbTest: getLinkedTab()
vbTest: checkTabExists()
vbTest: DESTINATION TAB: STATS
vbTest: ----------------------------------------------------------------
vbTest: DstTab-> ID: 52299712
vbTest: DstTab-> CurrentPath: C:\Users\steje\AppData\Roaming\GPSoftware\Directory Opus\Script AddIns
vbTest: DstTab-> LinkedTabID: 8325124
vbTest: DstTab-> InitialPath: C:\Users\steje\AppData\Roaming\GPSoftware\Directory Opus\Script AddIns
vbTest: DstTab-> LastPath: C:\Users\steje\AppData\Roaming\GPSoftware\Directory Opus\Script AddIns
vbTest: DstTab-> SyncState: True
- Now dblclick into the first level "child dir 1", you should get the following additional bit of output in the script log:
vbTest: Beginning OnAfterFolderChange handler...
vbTest:
vbTest: Typename(objSrcTabVar): Object
vbTest: objSrcTabVar-> LinkedTabID: 52299712
vbTest: We made it past the fetched objSrcTabVar var
vbTest: getLinkedTab()
vbTest: checkTabExists()
vbTest: ----------------------------------------------------------------
vbTest: Folder change detected:
vbTest: ----------------------------------------------------------------
vbTest: Current SrcPath: lib://My/Projects/opus/scripting/my.NavSync/test
vbTest: Current DstPath: C:\Users\steje\AppData\Roaming\GPSoftware\Directory Opus\Script AddIns
vbTest:
vbTest: Completed OnAfterFolderChange handler...
- Now dblclick into the second level "child dir 2", and you should crash right after the attempt to access data in the imported environment map in my OnAfterFolderChange() function directly after the last log message below:
vbTest: Beginning OnAfterFolderChange handler...
vbTest:
vbTest: Typename(objSrcTabVar): Object
If you want me to dumb the script down way further to make it easier to troubleshoot just shout.
Maybe you can tell me I just can't Set the local copies of the environment the way I am. I can certainly rebuild a new DOpusFactory.Map object and assign the values one at a time I guess before I write it out to the environment, which is where things are going wrong after the first folder change event I think. But doing it the same way as I am now with a Vector as opposed to a Map object works fine...?
The relevant code flow from the steps above is basically:
- Toggling the script on calls a script command accessible function (vbTest_On) that creates a new Map object with several key/value pairs and then sets that object as the value of my environment variable
- At this point things work... I can access the data as a Map object in a subsequent run of the script by running 'vbtest stats' command which the script adds
- And the first folder change event triggers code that accesses the Map as well (objSrcTabVar-> LinkedTabID)
- When I come back the next time around with the second folder change event - accessing the data written out as part of the first folder change, after the way I'm reading in the old environment data, then changing some of it before writing the new data back out to the environment without explicitly creating a new Map object is causing the crash
But it works as is with Vectors as a drop in replacement for the Map object - which I can show in a modified sample script if you like. Is this something basic I'm just doing wrong that first folder change?
my.vbTest.zip (81.1 KB)