Skip to content
This repository was archived by the owner on Sep 7, 2022. It is now read-only.

Commit f07d565

Browse files
authored
Merge pull request #181 from Unity-Technologies/revert-179-zgh/build_scripts
Revert "fix: app crash because of animating gif"
2 parents 6a5db87 + cff40ab commit f07d565

File tree

8 files changed

+14
-99
lines changed

8 files changed

+14
-99
lines changed

com.unity.uiwidgets/Runtime/painting/image_stream.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,6 @@ void _handleAppFrame(TimeSpan timestamp) {
444444
_emitFrame(new ImageInfo(image: _nextFrame.image, scale: _scale));
445445
_shownTimestamp = timestamp;
446446
_frameDuration = _nextFrame.duration;
447-
_nextFrame.DisposeCPtr();
448447
_nextFrame = null;
449448
int completedCycles = _codec.frameCount == 0 ? 0 : _framesEmitted / _codec.frameCount;
450449

com.unity.uiwidgets/Runtime/rendering/image.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ public Image image {
6464
if (value == _image) {
6565
return;
6666
}
67-
if(_image != null){
68-
_image.DisposeCPtr();
69-
}
67+
7068
_image = value;
7169
markNeedsPaint();
7270
if (_width == null || _height == null) {

com.unity.uiwidgets/Runtime/rendering/layer.cs

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,6 @@ public abstract class Layer : AbstractNodeMixinDiagnosticableTree {
5959
get { return (ContainerLayer) base.parent; }
6060
}
6161

62-
public virtual void DisposeCPtr()
63-
{
64-
if(_engineLayer != null) {
65-
_engineLayer.DisposeCPtr();
66-
}
67-
}
68-
6962
public bool _needsAddToScene = true;
7063

7164
protected void markNeedsAddToScene() {
@@ -105,9 +98,6 @@ bool debugSubtreeNeedsAddToScene {
10598
protected EngineLayer engineLayer {
10699
get { return _engineLayer; }
107100
set {
108-
if(_engineLayer != null){
109-
_engineLayer.DisposeCPtr();
110-
}
111101
_engineLayer = value;
112102
if (!alwaysNeedsAddToScene) {
113103
if (parent != null && !parent.alwaysNeedsAddToScene) {
@@ -254,14 +244,6 @@ public PictureLayer(Rect canvasBounds) {
254244
this.canvasBounds = canvasBounds;
255245
}
256246

257-
public override void DisposeCPtr()
258-
{
259-
base.DisposeCPtr();
260-
if(_picture != null){
261-
_picture.DisposeCPtr();
262-
}
263-
}
264-
265247
public readonly Rect canvasBounds;
266248

267249
Picture _picture;
@@ -504,16 +486,6 @@ protected List<PictureLayer> _debugCheckElevations() {
504486
return addedLayers;
505487
}
506488

507-
public override void DisposeCPtr() {
508-
base.DisposeCPtr();
509-
Layer child = firstChild;
510-
while (child != null) {
511-
Layer next = child.nextSibling;
512-
child.DisposeCPtr();
513-
child = next;
514-
}
515-
}
516-
517489
internal override void updateSubtreeNeedsAddToScene() {
518490
base.updateSubtreeNeedsAddToScene();
519491
Layer child = firstChild;
@@ -640,7 +612,6 @@ public void removeAllChildren() {
640612
child._nextSibling = null;
641613
D.assert(child.attached == attached);
642614
dropChild(child);
643-
child.DisposeCPtr();
644615
child = next;
645616
}
646617

com.unity.uiwidgets/Runtime/rendering/view.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public void compositeFrame() {
134134
using (var scene = layer.buildScene(builder)) {
135135
Window.instance.render(scene);
136136
}
137-
builder.DisposeCPtr();
137+
138138
D.assert(() => {
139139
if (D.debugRepaintRainbowEnabled || D.debugRepaintTextRainbowEnabled) {
140140
D.debugCurrentRepaintColor =

com.unity.uiwidgets/Runtime/ui/compositing.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,11 @@ internal PhysicalShapeEngineLayer(IntPtr ptr) : base(ptr) {
140140
}
141141
}
142142

143-
public class SceneBuilder : NativeWrapperCPtrDisposable {
143+
public class SceneBuilder : NativeWrapper {
144144
public SceneBuilder() : base(SceneBuilder_constructor()) {
145145
}
146146

147-
public override void DisposeCPtrImpl(IntPtr ptr) {
147+
public override void DisposePtr(IntPtr ptr) {
148148
SceneBuilder_dispose(ptr);
149149
}
150150

com.unity.uiwidgets/Runtime/ui/native_bindings.cs

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -64,36 +64,4 @@ public void Dispose() {
6464
_dispose();
6565
}
6666
}
67-
68-
/// <summary>
69-
/// This class is used to release c++ resources in advance without waiting for c# garbage collection.
70-
/// Please make sure that the resource will not be used again after it is released.
71-
/// Releasing resources prematurely may cause null pointer exceptions in references elsewhere.
72-
///
73-
/// Usage:
74-
/// Use DisposeCPtr() to manually release c++ resources, and then add an interface to release unmanaged memory
75-
/// in DisposeCPtrImpl(IntPtr ptr).
76-
/// </summary>
77-
public abstract class NativeWrapperCPtrDisposable : NativeWrapperDisposable {
78-
public bool isDisposed = false;
79-
80-
protected NativeWrapperCPtrDisposable() {
81-
}
82-
83-
protected NativeWrapperCPtrDisposable(IntPtr ptr) : base(ptr) {
84-
}
85-
86-
public void DisposeCPtr() {
87-
DisposePtr(_ptr);
88-
}
89-
public override void DisposePtr(IntPtr ptr) {
90-
if(isDisposed){
91-
return;
92-
}
93-
isDisposed = true;
94-
DisposeCPtrImpl(ptr);
95-
}
96-
97-
public abstract void DisposeCPtrImpl(IntPtr ptr);
98-
}
9967
}

com.unity.uiwidgets/Runtime/ui/painting.cs

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -763,13 +763,12 @@ internal _ImageInfo(int width, int height, int format, int? rowBytes = null) {
763763
public int rowBytes;
764764
}
765765

766-
public class Image : NativeWrapperCPtrDisposable, IEquatable<Image> {
767-
766+
public class Image : NativeWrapperDisposable, IEquatable<Image> {
768767
internal Image(IntPtr ptr) : base(ptr) {
769768
}
770769

771-
public override void DisposeCPtrImpl(IntPtr ptr) {
772-
Image_dispose(ptr);
770+
public override void DisposePtr(IntPtr ptr) {
771+
Image_dispose(ptr);
773772
}
774773

775774
public int width => Image_width(_ptr);
@@ -881,31 +880,18 @@ public override int GetHashCode() {
881880

882881
public delegate void ImageDecoderCallback(Image result);
883882

884-
public class FrameInfo : NativeWrapperCPtrDisposable {
885-
883+
public class FrameInfo : NativeWrapper {
886884
internal FrameInfo(IntPtr ptr) : base(ptr) {
887885
}
888886

889-
public override void DisposeCPtrImpl(IntPtr ptr) {
887+
public override void DisposePtr(IntPtr ptr) {
890888
FrameInfo_dispose(ptr);
891889
}
892890

893-
894891
public TimeSpan duration => TimeSpan.FromMilliseconds(_durationMillis);
895892
int _durationMillis => FrameInfo_durationMillis(_ptr);
896893

897-
898-
private Image _image;
899-
900-
public Image image {
901-
get {
902-
if(_image == null){
903-
_image = new Image(FrameInfo_image(_ptr));
904-
}
905-
906-
return _image;
907-
}
908-
}
894+
public Image image => new Image(FrameInfo_image(_ptr));
909895

910896
[DllImport(NativeBindings.dllName)]
911897
static extern void FrameInfo_dispose(IntPtr ptr);
@@ -1069,11 +1055,11 @@ public enum PathOperation {
10691055
reverseDifference,
10701056
}
10711057

1072-
public abstract class EngineLayer : NativeWrapperCPtrDisposable {
1058+
public abstract class EngineLayer : NativeWrapper {
10731059
protected EngineLayer(IntPtr ptr) : base(ptr) {
10741060
}
10751061

1076-
public override void DisposeCPtrImpl(IntPtr ptr) {
1062+
public override void DisposePtr(IntPtr ptr) {
10771063
EngineLayer_dispose(ptr);
10781064
}
10791065

@@ -2858,12 +2844,11 @@ static extern void Canvas_drawShadow(IntPtr ptr, IntPtr path, uint color, float
28582844
bool transparentOccluder);
28592845
}
28602846

2861-
public class Picture : NativeWrapperCPtrDisposable {
2862-
2847+
public class Picture : NativeWrapperDisposable {
28632848
internal Picture(IntPtr ptr) : base(ptr) {
28642849
}
28652850

2866-
public override void DisposeCPtrImpl(IntPtr ptr) {
2851+
public override void DisposePtr(IntPtr ptr) {
28672852
Picture_dispose(ptr);
28682853
}
28692854

com.unity.uiwidgets/Runtime/widgets/widget_inspector.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2444,12 +2444,6 @@ Rect targetRect
24442444
}
24452445

24462446

2447-
public override void DisposeCPtr() {
2448-
if(_picture != null){
2449-
_picture.DisposeCPtr();
2450-
}
2451-
}
2452-
24532447
public override bool findAnnotations<S>(
24542448
AnnotationResult<S> result,
24552449
Offset localPosition,

0 commit comments

Comments
 (0)