add h_add_ref; add leak report (currently disabled, since all textures are leaked)
This was SVN commit r1511.
This commit is contained in:
parent
855c00f6b8
commit
851a30215f
@ -444,6 +444,9 @@ void h_mgr_shutdown()
|
||||
if(!hd->tag)
|
||||
continue;
|
||||
|
||||
// if(hd->refs != 0)
|
||||
// debug_out("leaked %s from %s\n", hd->type->name, hd->fn);
|
||||
|
||||
// disable caching; we need to release the resource now.
|
||||
hd->keep_open = 0;
|
||||
hd->refs = 0;
|
||||
@ -740,6 +743,26 @@ int h_force_free(Handle h, H_Type type)
|
||||
}
|
||||
|
||||
|
||||
// increment Handle <h>'s refcount.
|
||||
// only meant to be used for objects that free a Handle in their dtor,
|
||||
// so that they are copy-equivalent and can be stored in a STL container.
|
||||
// do not use this to implement refcounting on top of the Handle scheme,
|
||||
// e.g. loading a Handle once and then passing it around. instead, have each
|
||||
// user load the resource; refcounting is done under the hood.
|
||||
void h_add_ref(Handle h)
|
||||
{
|
||||
HDATA* hd = h_data_tag(h);
|
||||
if(!hd)
|
||||
{
|
||||
debug_warn("h_add_ref: invalid handle");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!hd->refs)
|
||||
debug_warn("h_add_ref: no refs open - resource is cached");
|
||||
hd->refs++;
|
||||
}
|
||||
|
||||
|
||||
int res_cur_scope;
|
||||
|
||||
|
@ -209,6 +209,14 @@ extern int res_cur_scope;
|
||||
// at that point, all (cached) OpenAL resources must be freed.
|
||||
extern int h_force_free(Handle h, H_Type type);
|
||||
|
||||
// increment Handle <h>'s refcount.
|
||||
// only meant to be used for objects that free a Handle in their dtor,
|
||||
// so that they are copy-equivalent and can be stored in a STL container.
|
||||
// do not use this to implement refcounting on top of the Handle scheme,
|
||||
// e.g. loading a Handle once and then passing it around. instead, have each
|
||||
// user load the resource; refcounting is done under the hood.
|
||||
extern void h_add_ref(Handle h);
|
||||
|
||||
extern void h_mgr_shutdown();
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user