Revision ccd98f1c
Added by Leszek Koltunski about 5 years ago
src/main/java/org/distorted/library/main/DistortedBuffer.java | ||
---|---|---|
42 | 42 |
|
43 | 43 |
public DistortedBuffer(int target, int usage) |
44 | 44 |
{ |
45 |
super(DistortedObject.NOT_CREATED_YET,DistortedObject.TYPE_USER);
|
|
45 |
super(DistortedObject.TYPE_USER); |
|
46 | 46 |
|
47 | 47 |
mIndex = new int[1]; |
48 | 48 |
mTarget = target; |
49 | 49 |
mUsage = usage; |
50 |
mBuffer = null; |
|
51 |
mSize = 0; |
|
50 | 52 |
|
51 | 53 |
recreate(); |
52 | 54 |
} |
53 | 55 |
|
54 | 56 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
57 |
// mark for creation only now, when we do have all data ready, in order to avoid the situation |
|
58 |
// when create() would be called before this. |
|
55 | 59 |
|
56 | 60 |
public void setData(int size, Buffer buffer) |
57 | 61 |
{ |
58 | 62 |
mSize = size; |
59 | 63 |
mBuffer = buffer; |
64 |
|
|
65 |
markForCreation(); |
|
60 | 66 |
} |
61 | 67 |
|
62 | 68 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Correct a bug in DistortedBuffer: we only mark it for creation when we actually have all the data ready, otherwise it can happen that create(0 is called before setData() !