[blob] Implement sub_blob() in terms of create()
Fixes problem with uninitialized sub_blob->mutex among other things. Reported by Bradley Grainger.
This commit is contained in:
parent
fc52e9e44c
commit
d4141a44b9
|
@ -127,16 +127,14 @@ hb_blob_create_sub_blob (hb_blob_t *parent,
|
||||||
|
|
||||||
pdata = hb_blob_lock (parent);
|
pdata = hb_blob_lock (parent);
|
||||||
|
|
||||||
blob->data = pdata + offset;
|
|
||||||
blob->length = MIN (length, parent->length - offset);
|
|
||||||
|
|
||||||
hb_mutex_lock (parent->lock);
|
hb_mutex_lock (parent->lock);
|
||||||
blob->mode = parent->mode;
|
blob = hb_blob_create (pdata + offset,
|
||||||
|
MIN (length, parent->length - offset),
|
||||||
|
parent->mode,
|
||||||
|
hb_blob_reference (parent),
|
||||||
|
(hb_destroy_func_t) _hb_blob_unlock_and_destroy);
|
||||||
hb_mutex_unlock (parent->lock);
|
hb_mutex_unlock (parent->lock);
|
||||||
|
|
||||||
blob->user_data = hb_blob_reference (parent);
|
|
||||||
blob->destroy = (hb_destroy_func_t) _hb_blob_unlock_and_destroy;
|
|
||||||
|
|
||||||
return blob;
|
return blob;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue