Merge lp:~mconley/globalmenu-extension/fix-segfault-with-lightning into lp:~chrisccoulson/globalmenu-extension/trunk

Proposed by Mike Conley
Status: Merged
Merged at revision: 76
Proposed branch: lp:~mconley/globalmenu-extension/fix-segfault-with-lightning
Merge into: lp:~chrisccoulson/globalmenu-extension/trunk
Diff against target: 13 lines (+3/-0)
1 file modified
extensions/globalmenu/components/src/uGlobalMenu.cpp (+3/-0)
To merge this branch: bzr merge lp:~mconley/globalmenu-extension/fix-segfault-with-lightning
Reviewer Review Type Date Requested Status
Chris Coulson Needs Information
Review via email: mp+47954@code.launchpad.net

Description of the change

While going through <menubar> nodes, the extension was only expecting menuSeperator, menuItem and the like. If it saw something it didn't expect (<observes>, for example), it'd hang.

Now, if the extension sees a tag it doesn't recognize, it just skips over it.

To post a comment you must log in.
Revision history for this message
Chris Coulson (chrisccoulson) wrote :

Thanks for figuring this out.

I had a thought this morning though. Whilst this fixes the original crash, I think there is still an unsolved issue here that will manifest later on.

The way this is designed, relies on each DbusmenuMenuitem to be inserted in to it's DbusmenuMenuitem parent at the same index as it's corresponding DOM node. If we skip a node, I think everything ends up going off-by-1.

Once this has happened, I think we'll end with bits of the menu ending up in the wrong order as other menuitems are inserted, and we could end up removing the wrong menuitems (or crashing) when nodes are removed.

Does this make sense?

I'm not sure of the best way to fix that, other than creating invisible dummy nodes in the menu, just to keep everything in sync.

review: Needs Information

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'extensions/globalmenu/components/src/uGlobalMenu.cpp'
2--- extensions/globalmenu/components/src/uGlobalMenu.cpp 2011-01-21 01:45:13 +0000
3+++ extensions/globalmenu/components/src/uGlobalMenu.cpp 2011-01-31 01:16:43 +0000
4@@ -430,6 +430,9 @@
5 mListener,
6 child);
7 newItem = static_cast<uGlobalMenuObject *>(sep);
8+ } else {
9+ // We didn't recognize the tag. Ignore it, and move on.
10+ continue;
11 }
12
13 AppendMenuObject(newItem);

Subscribers

People subscribed via source and target branches

to all changes: