Memory cleanup

Registered by Zsombor Egri

There are some memory leaks and cleanup problems in styling engine. These should be addressed.

Blueprint information

Status:
Complete
Approver:
Zoltan Balogh
Priority:
Undefined
Drafter:
Zsombor Egri
Direction:
Needs approval
Assignee:
Zsombor Egri
Definition:
New
Series goal:
Accepted for raring
Implementation:
Implemented
Milestone target:
milestone icon ubuntu-13.04-month-6
Started by
Zsombor Egri
Completed by
Zsombor Egri

Sprints

Whiteboard

=== modified file 'modules/Ubuntu/Components/plugin/itemstyleattached.cpp'
--- modules/Ubuntu/Components/plugin/itemstyleattached.cpp 2013-02-26 16:56:02 +0000
+++ modules/Ubuntu/Components/plugin/itemstyleattached.cpp 2013-03-06 11:32:14 +0000
@@ -172,6 +172,10 @@
     // remove name from the theming engine
     if (!styleData.styleId.isEmpty())
         ThemeEnginePrivate::registerName(attachee, QString());
+
+ delete componentContext;
+ //delete style; // FIXME: crashes the shell after unlock
+ delete delegate;
 }

 bool ItemStyleAttachedPrivate::updateStyleSelector()

=== modified file 'modules/Ubuntu/Components/plugin/suffixtree.cpp'
--- modules/Ubuntu/Components/plugin/suffixtree.cpp 2013-03-01 07:45:49 +0000
+++ modules/Ubuntu/Components/plugin/suffixtree.cpp 2013-03-06 11:32:14 +0000
@@ -203,6 +203,8 @@

 StyleTreeNode::~StyleTreeNode()
 {
+ delete style;
+ delete delegate;
     clear();
 }

@@ -238,6 +240,8 @@
         // had not yet have a style set
         if (children.contains(nodeKey)) {
             StyleTreeNode *node = children.value(nodeKey);
+ delete node->style;
+ delete node->delegate;
             node->style = style;
             node->delegate = delegate;
         } else {

Note: despite of setting parent for style and delegate objects, those are not deleted when the styled item (attachee) is destroyed. Therefore explicit deletion of those must be done.

(?)

Work Items

Work items:
Delete style and delegate objects explicitly in ItemStyleAttached destruction: DONE
Leak - context object used for style and delegate creation is not deleted: DONE
Safety deletion of style and delegate QQmlComponent objects when StyleCache tree is built: DONE

Dependency tree

* Blueprints in grey have been implemented.

This blueprint contains Public information 
Everyone can see this information.