mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-09 19:10:15 +08:00
[meta/buffer]: Fix usage after service is destoyed
When C++ global destructor is called MppBufferService and MppMetaService maybe be called before other destructors which may call mpp_buffer_put and mpp_meta_put. So we mark finished flag after ~MppBufferService and ~MppMetaService is call and so not free corresponding data again. This case usually happens when user call exit() directly. Change-Id: I997c49b095e443b061fca230587b6216f710d31c Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
@@ -75,6 +75,7 @@ private:
|
||||
RK_U32 group_id;
|
||||
RK_U32 group_count;
|
||||
RK_U32 finalizing;
|
||||
RK_U32 finished;
|
||||
|
||||
// misc group for internal / externl buffer with different type
|
||||
MppBufferGroupImpl *misc[MPP_BUFFER_MODE_BUTT][MPP_BUFFER_TYPE_BUTT];
|
||||
@@ -604,6 +605,7 @@ MppBufferService::MppBufferService()
|
||||
: group_id(0),
|
||||
group_count(0),
|
||||
finalizing(0),
|
||||
finished(0),
|
||||
misc_count(0)
|
||||
{
|
||||
RK_S32 i, j;
|
||||
@@ -655,6 +657,7 @@ MppBufferService::~MppBufferService()
|
||||
deinit_buffer_no_lock(pos, __FUNCTION__);
|
||||
}
|
||||
}
|
||||
finished = 1;
|
||||
}
|
||||
|
||||
RK_U32 MppBufferService::get_group_id()
|
||||
@@ -745,6 +748,9 @@ void MppBufferService::set_misc(MppBufferMode mode, MppBufferType type, MppBuffe
|
||||
|
||||
void MppBufferService::put_group(MppBufferGroupImpl *p)
|
||||
{
|
||||
if (finished)
|
||||
return ;
|
||||
|
||||
buffer_group_add_log(p, NULL, GRP_RELEASE, __FUNCTION__);
|
||||
|
||||
// remove unused list
|
||||
|
Reference in New Issue
Block a user