Unity icon indicating copy to clipboard operation
Unity copied to clipboard

Audit Dispose pattern in the codebase and add it to the style guide for reference

Open shana opened this issue 8 years ago • 4 comments

We should add the Dispose pattern to the style guide so we don't have to go hunting for it whenever we need it. We should also audit the existing code to make sure it follows the correct pattern where it needs to.

private bool disposed;
public virtual void Dispose(bool disposing)
{
    if (disposed) return;
    disposed = true;
    if (disposing) {
        // dispose managed stuff
    }
    // dispose native stuff that we hold an exclusive reference to (nobody else is going to kill them off via GC or finalizer). Do not access any data via managed references here.
}

public void Dispose()
{
  Dispose(true);
}

shana avatar Jul 05 '17 13:07 shana

I'll do this.

where is the style guide? I'm unable to find it.

AkashGutha avatar Sep 13 '17 13:09 AkashGutha

@AkashGutha https://github.com/github-for-unity/Unity/blob/master/docs/contributing/styleguide.md

Frozenfire92 avatar Mar 21 '18 21:03 Frozenfire92

Oh wow I totally forgot about this, thanks @Frozenfire92

shana avatar Mar 21 '18 21:03 shana

GitHub utilitário in developmente and Support for unity the blob máster.

MariaAp80 avatar Sep 03 '20 19:09 MariaAp80