Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums VEGAS Pro Vegas corruption…

  • Vegas corruption…

    Posted by Karl Goldshmidt on February 26, 2009 at 8:05 pm

    Hello all,

    I’ve been writing a few scripts under Vegas 8.0c, and once in a blue moon have noticed something, not good. Somehow, it is possible to corrupt Vegas and its pointers for the media bins. Its not noticeable to the user, but a script will fail (hard exception – using C#). For example, looking at the data in memory, a bin that might show to the user only 12 or so media clips and sub-bins, says it actually has 40 ‘things’ in the list. I’ve not been able to access any of the things at that level, the code just dies deep within Vegas.

    This is the end of the stack trace when the error occurs (was just trying to access the NodeType of the first thing in that bin):
    System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.
    at Sony.Vegas.IMediaCOM.GetMetaPathType(UInt32 mediaID, MetaPathType& metaType)
    at Sony.Vegas.Media.CreateInstance(UInt32 mediaID)
    at Sony.Vegas.MediaBin.GetItem(Int32 index)
    at Sony.Vegas.BaseList`1.get_Item(Int32 index)

    I’m curious if anyone else has noticed/seen this, might know the cause, maybe a workaround ? I have not been able to get a repeatable case yet (only seen this twice, but has me worried…)

    Karl ‘krash’ Goldshmidt
    Blur Studio

    John Rofrano replied 17 years, 5 months ago 2 Members · 2 Replies
  • 2 Replies
  • Karl Goldshmidt

    March 17, 2009 at 11:13 pm

    Interesting no-one else has noticed it. I can reproduce the bug easily:

    For example:
    1) Create a bin
    2) Dump some media into the bin

    3) delete media
    Seems like whenever someone deletes media that was placed into a mediabin, the bin ends up in a corrupted state ? Its happened using “Remove from Current Bin”, “Remove from Project”, and “Remove All Unused Media From Project”. Any script that then tries to access the bin will throw an exception.

    4) run script Bin-Corruption-0002

    Note that the script thinks there is still something inside the bin (Count = 1 ?), but accessing it will cause the exception.

    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Windows.Forms;

    using Sony.Vegas;

    namespace Bin_Corruption_0002
    {
    public class EntryPoint
    {
    static internal Sony.Vegas.Vegas thisVegas = null;

    public void FromVegas(Vegas vegas)
    {
    using (UndoBlock undo = new UndoBlock(“Bin Corruption Test”))
    {
    thisVegas = vegas;

    MessageBox.Show(thisVegas.Project.MediaPool.RootMediaBin.Count.ToString(), “thisVegas.Project.MediaPool.RootMediaBin.Count”);
    // top level should all be bins…
    foreach (Sony.Vegas.MediaBin bin in thisVegas.Project.MediaPool.RootMediaBin)
    {
    MessageBox.Show(bin.Name, “bin.Name”);
    MessageBox.Show(bin.Count.ToString(), “bin.Count”);
    foreach (Sony.Vegas.IMediaBinNode loopBin in bin)
    {
    if (loopBin.NodeType == MediaBinNodeType.Bin)
    {
    MessageBox.Show(((Sony.Vegas.MediaBin)loopBin).Name, “loopBin.Name”);
    }
    else if (loopBin.NodeType == MediaBinNodeType.MediaRef)
    {
    MessageBox.Show(((Sony.Vegas.Media)loopBin).FilePath, “loopBin.FilePath”);
    }
    else
    {
    MessageBox.Show(“Unknown Media Type ?”, “ERROR”);
    }
    }
    }
    }
    }
    }
    }

    is there something I’m doing wrong, or has no-one really noticed this before ?

    TIA,
    krash
    Blur Studio

  • John Rofrano

    March 18, 2009 at 12:55 pm

    The Vegas Script API has several “nasty” bugs with regard to Media bins and I have just learned to code around them. I have my own set of routines that handle this and catch exceptions. One behavior to be aware of is what you have just found: Removing media from a bin does not remove it from the pool. Your code must first remove from the bin and then remove from the pool in that order, to avoid this condition. One might think that removing it from the pool would remove it from all bins but that’s not the behavior that’s implemented.

    Another one is when bins report themselves as their own parent bin which throws you into an infinite recursion unless you limit it with a counter in your code. You just learn to live with these quirks.

    ~jr

    http://www.johnrofrano.com
    http://www.vasst.com

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy