解决配置对象内存泄漏
This commit is contained in:
parent
729c261917
commit
8cde3ad57b
|
@ -178,7 +178,8 @@ namespace gb
|
|||
simple_val_.dval = val;
|
||||
}
|
||||
json::json(const char* key, const char* val) : type_(VAL_TYPE_STRING), key_(key ? key : ""), strval_(val ? val : ""), cur_child_(-1)
|
||||
{}
|
||||
{
|
||||
}
|
||||
json::json(json& r)
|
||||
{
|
||||
copy_from(r);
|
||||
|
@ -1437,6 +1438,7 @@ namespace gb
|
|||
name = child->key();
|
||||
child->value(raw_v);
|
||||
val = sane_config_schm::from_hex_letter(raw_v.c_str(), raw_v.length());
|
||||
child->release();
|
||||
|
||||
ret = true;
|
||||
}
|
||||
|
@ -1454,6 +1456,7 @@ namespace gb
|
|||
name = child->key();
|
||||
child->value(raw_v);
|
||||
val = sane_config_schm::from_hex_letter(raw_v.c_str(), raw_v.length());
|
||||
child->release();
|
||||
|
||||
ret = true;
|
||||
}
|
||||
|
@ -1706,6 +1709,7 @@ namespace gb
|
|||
{
|
||||
clear();
|
||||
global_->release();
|
||||
opt_default_value_->release();
|
||||
}
|
||||
|
||||
bool scanner_cfg::update(const char* file, LPUDF func)
|
||||
|
@ -1776,6 +1780,7 @@ namespace gb
|
|||
glb->get_value(scanner_cfg::cur_sel_.c_str(), sel);
|
||||
glb->release();
|
||||
glb = jsn->first_child();
|
||||
glb->release();
|
||||
while ((glb = jsn->next_child()))
|
||||
{
|
||||
std::string val("");
|
||||
|
|
|
@ -544,6 +544,7 @@ scanner::~scanner()
|
|||
|
||||
if (cfg_)
|
||||
{
|
||||
cfg_->remove_all_schemes(); // schemes would add_ref on cfg_, so we clear them first. NOTE: do not call save after this !!!
|
||||
cfg_->release();
|
||||
cfg_ = NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue