Is it safe to overwritten a widget value right after calling deleteLater?
Unsolved
General and Desktop
-
When i call
shadow_map[widget].eff->deleteLater();
and in the next line overwrite the value
of theeff
into the shadow_map, does it still will get deleted as its value got overwritten?struct Shadow { GraphicsEffect* eff = nullptr; //... }; QMap<QWidget*, Shadow> shadow_map; void setShadow(Shadow& shadow, QWidget* widget = nullptr) { if (widget) shadow.widget = widget; else widget = shadow.widget; GraphicsEffect* eff = new GraphicsEffect(...); shadow.eff = eff; if (shadow_map.contains(widget)) { shadow_map[widget].eff->deleteLater(); shadow_map[widget] = shadow; } }
-
You don't override the value, just a pointer so you don't modify the object deleteLater() was called upon.