关于内存泄漏
来源:14-9 项目的换肤实现4
tobeabee
2022-04-01
老师,在我们本节(12-9)视频的9:43的如下代码,是不是少了一次delete settingini?我下面用注释做了标记
if (url == NULL) {
if (backGroundpath == NULL) {
delete settingini;
return;
}
else {
m_strBackgroundPath = backGroundpath;
m_strBackgroundChoosePath = backGroundpath;
delete settingini;
emit backGroundChanged(m_strBackgroundPath);
emit backGroundChooseChanged(m_strBackgroundChoosePath);
}
}
else {
if (url != m_strBackgroundPath) {
settingini->setValue(“Path/Background”, url);
m_strBackgroundPath = url;
m_strBackgroundChoosePath = url;
//这里需要delete settingini吧?
emit backGroundChanged(m_strBackgroundPath);
emit backGroundChooseChanged(m_strBackgroundChoosePath);
}
}
写回答
1回答
-
不是啊,这时settingini是需要的,你仔细看看逻辑。
012022-04-01
相似问题