OwnerAttribute
Description
- Derived from
-
Attribute abstract
The Owner is used on storage containers (i.e. local variables, method/constructor parameters and fields) to declare ownership of disposable objects.
The following rules depict - based on the ownership status - when a disposable object must be disposed and when disposal must not be performed. Going by these rules will avoid situations where a resource is disposed, although it is still being used and situations when a resource is never explicitly disposed, thus wasting system resources.
-
When used on a local variable:
A local variable is considered being attributed iff it is followed by a comment statement and the comment (after eliminating leading and trailing whitespaces) is equal to'[!]'
:... IDisposable myObj; // [!] ...
The local variable takes ownership of the disposable object that is assigned to it. The code block that declares the local variable is responsible for disposing the object(s) that it stores in the local variable.
-
When used on an instance field:
... [Owner] IDisposable myObj; ...
The declaring class is responsible for disposing the fields value. This implies that the class itself must be disposable (i.e. it must declare a non-static disposal method, see Dispose). The attributed field must be disposed in the classes disposal method.
-
When used on a method/constructor parameter:
... void SomeMethod([Owner] IDisposable myObj) { ... } ...
The parameter takes ownership of the disposable object that is passed to it and the method body becomes responsible for disposal.
The semantic hint CX.Mine can be used to sanitize an ownership transfer (None => Take) that is detected as invalid by static code analysis but is known to be correct.
- See also
Usages
ApplicationLoop.ApplicationLoop1 constructor
ApplicationLoop.ApplicationLoop2 constructor
BingMapsPyramid.BingMapsPyramid1 constructor
BingMapsPyramid.BingMapsPyramid2 constructor
BlockIndexBase.pool field
BlockStorage.Create method
BlockStorage.Get method
BlockStorage.New method
BlockStorage.Open method
BlockStorage.Set method
Brush.InputHeightmap method
Canvas.Canvas constructor
Canvas.content field
CanvasFactoryHeightmap.CanvasFactoryHeightmap constructor
CanvasFactoryPixelPyramid.CanvasFactoryPixelPyramid constructor
CharacterEncoding.EncodeString method
ColorBuffer.FromImage4 method
ColorBuffer.ReadPXB2 method
ColorBuffer.ReadPXBInfo2 method
ColorBuffer.WritePXB2 method
Component.textFont field
Component.textFontHint field
CompositeBrushOne.brush field
CompositeBrushOne.CompositeBrushOne constructor
CompositeBrushTwo.CompositeBrushTwo constructor
CompositeBrushTwo.first field
CompositeBrushTwo.second field
CompositeHeightmapOne.CompositeHeightmapOne constructor
CompositeHeightmapOne.heightmap field
CompositeHeightmapTwo.CompositeHeightmapTwo constructor
CompositeHeightmapTwo.firstHeightmap field
CompositeHeightmapTwo.secondHeightmap field
CompositePixelPyramid.CompositePixelPyramid1 constructor
CompositePixelPyramid.CompositePixelPyramid2 constructor
CompositePixelPyramid.pyramid field
CompositeTexelPyramid.CompositeTexelPyramid1 constructor
CompositeTexelPyramid.CompositeTexelPyramid2 constructor
CompositeTexelPyramid.pyramid field
ConfigDoc.Load2 method
ConfigValueBrowser.BrowseWidget method
ConfigValueBrowser_Tinman_AddOns.BrowseHeightmap method
ConfigValueBrowser_Tinman_AddOns.BrowseModelReader method
ConfigValueBrowser_Tinman_AddOns.BrowsePixelPyramid method
Container.ChildAdd1 method
Container.ChildAdd2 method
CountingPyramid.CountingPyramid constructor
CoverageBuffer.FromImage3 method
CsvReader.CsvReader constructor
CsvWriter.CsvWriter constructor
CX.Dispose method
CX.DisposeAll method
CX.Thine method
DataGrid.DataGrid constructor
DatasetCollection.DoOpen method
DatasetCollection.Open5 method
DataUpdaterList.Add method
DataUpdaterList.entries field
DataUpdaterList.monitor field
DemoApplication.DemoApplication constructor
DemoApplication.Main method
DirectX11Context.ForDevice method
DirectX11RenderTarget.DirectX11RenderTarget constructor
DirectX9Context.ForDevice method
DirectX9RenderTarget.DirectX9RenderTarget constructor
DisposableUtil.CastOwn method
DisposableUtil.DisposeAll1 method
DisposableUtil.DisposeAll2 method
DisposableUtil.DisposeValues method
Disposer.Add method
ElevationBuffer.FromImage3 method
Example_PixelFont.Generate_Alterebro method
Example_PixelFont.Generate_Emoji method
Example_PixelFont.Generate_NanumBarunGothic method
Example_TextureStreaming.streaming field
GeometryBuffer.GeometryBuffer constructor
GeometryBuffer.indices field
GeometryBuffer.instances field
GeometryBuffer.vertices field
GeoRegistry.Load2 method
GeoRegistry.Save2 method
GL.GL constructor
GLBase.Create method
GLBase.GLBase constructor
GLBaseWithDebug.GLBaseWithDebug constructor
GLContext.FrameBufferObjectDelete method
GLContext.GLContext constructor
GLContext.renderContext field
GLContext.VertexArrayObjectDelete method
GLEffect.SamplerStateCreate2 method
GLES.GLES constructor
GLGeometryBuffer.GLGeometryBuffer constructor
GLSC.GLSC constructor
GoogleMapsPyramid.GoogleMapsPyramid1 constructor
GoogleMapsPyramid.GoogleMapsPyramid2 constructor
Heightmap.Merge method
Heightmap.onUpdated field
HeightmapBuilder.Dataset3 method
HeightmapGrinder.Add1 method
HeightmapGrinder.Add2 method
HeightmapRegionPyramid.LayerAdd method
HttpFile.HttpFile constructor
HttpPyramid.HttpPyramid constructor
IApplication.RunOperation method
IBinaryDigest.FinishDigestBuffer method
IBrush.Append method
IBrush.Combine method
IBrush.Merge method
IBrush.Modulate method
IBrush.OutputHeightmap method
IBrush.Prepend method
ICanvasFactory.CreateCanvas method
IDataset.UseCache method
IGraphicsContext.CreateGeometryBuffer method
IHeightmapOps.Clip method
IHeightmapOps.Combine method
IHeightmapOps.Merge method
IImageOps.IntensityToChannel2 method
IImageOps.Op method
IImageWriter.WriteImage method
ILogMessageSource.AddHandler method
IObjectPoolFactory.Delete method
IOperationOps.And method
IOperationOps.Then method
IPixelPyramid.Cache2 method
IResourceConsumer.ConsumeLoadedResource method
ISceneEntityContainer.EntityAdd method
ISceneView.EntityViewAdd method
ITexelPyramid.Cache method
IWidgetFactory.CreateWidget method
IWidgetGui.ButtonAdd method
IWidgetGui.DialogShow method
IWidgetGui.PanelAdd method
MemoryDataStream.Wrap method
MemoryFileSystem.FilePut method
MeshBuffer.Create method
MeshBuffer.MeshCreate method
MeshChunkBuilder.MeshChunkBuilder constructor
MeshChunkBuilder.Texture2 method
ModelInfo.ModelInfo constructor
ModelWidget.LoadModel method
ObjectDataCache.Set method
ObjectPool.ObjectPool constructor
ObjectPoolBase.ObjectPoolBase constructor
OpenGLContext.OpenGLContext constructor
OpenGLESContext.OpenGLESContext constructor
OpenStreetMapPyramid.OpenStreetMapPyramid constructor
ParticleEffect.ParticleEffect constructor
PixelPyramidBuilder.Dataset3 method
PixelPyramidGrinder.Add method
PixelPyramidGrinder.Pyramid method
PixelPyramidGrinder.PyramidSize method
PyramidBase.onUpdated field
RingBuffer.RingBuffer constructor
Run.This1 method
Run.This2 method
Run.This3 method
Run.This4 method
Run.This5 method
Run.This6 method
SceneView.SceneView constructor
SceneViewWidget.SceneCreate method
SceneViewWidget.SceneSet method
Serializer.Deserialize1 method
Serializer.Deserialize2 method
Shape.ReadCSH2 method
SourceCodeWriter.SourceCodeWriter constructor
Streaming.Streaming constructor
TerrainBuffer.TerrainBuffer constructor
TerrainLayerSlot.Prepare method
TerrainLayerSlot.Set method
TerrainMesh.TerrainMesh constructor
TerrainView.TerrainView constructor
TerrainViewWidget.TerrainCreate method
TerrainViewWidget.TerrainSet method
TexelBuffer.ReadTXB2 method
TexelBuffer.ReadTXBInfo2 method
TexelBuffer.TexelBuffer constructor
TexelBuffer.texels field
TexelBuffer.WriteTXB2 method
TexelBufferBitPattern.TexelBufferBitPattern constructor
TexelBufferBitPattern16.TexelBufferBitPattern16 constructor
TexelBufferBitPattern32.TexelBufferBitPattern32 constructor
TexelBufferBitPattern64.TexelBufferBitPattern64 constructor
TextureAtlas.PyramidIdAllocate method
TextureAtlasOptions.CreateTextureAtlas method
TextureData2D.For1 method
TextureData2D.For2 method
TextureFormat.CreateBuffer method
TextureLayer.ContentAt2 method
Thread.Create method
Thread.DisposeAll method
TinmanModule.PrepareResource2 method
Tutorial_03_Widget.widget field
Tutorial_10_Tinman.gravity field
Tutorial_10_Tinman.mesh field
Tutorial_10_Tinman.meshBuffer field
Tutorial_11_Render.effect field
Tutorial_20_TerrainViewWidget.CreateTerrain method
Tutorial_30_SceneViewWidget.CreateSceneAndPrimaryView method
UrlPatternPyramid.UrlPatternPyramid constructor
Versioned.Sum2 method
VertexBufferCache.VertexBufferCache constructor
VisualCache.VisualCache constructor
WGLContext.WGLContext constructor
Widget.Create method
Widget.CreateNull method
WidgetApplication.WidgetAdd method
WidgetDialogBuilder.Content1 method