~ubuntu-branches/ubuntu/utopic/qmenumodel/utopic-proposed

« back to all changes in this revision

Viewing changes to libqmenumodel/src/unitymenuaction.cpp

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Charles Kerr, Nick Dedekind
  • Date: 2014-07-04 07:38:11 UTC
  • mfrom: (1.1.17)
  • Revision ID: package-import@ubuntu.com-20140704073811-vhvywosl4t7464pr
Tags: 0.2.7+14.10.20140704-0ubuntu1
[ Charles Kerr ]
* Fix a dangling UnityMenuAction pointer by ensuring it's registered
  with only one menu at a time. (LP: #1282282)

[ Nick Dedekind ]
* Unset the UnityMenuActions::model when destroying UnityMenuModel
  (LP: #1334203)

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
 
34
34
UnityMenuAction::~UnityMenuAction()
35
35
{
36
 
    if (m_model) {
37
 
        m_model->unregisterAction(this);
38
 
    }
 
36
    unregisterAction();
39
37
}
40
38
 
41
39
QString UnityMenuAction::name() const
59
57
void UnityMenuAction::setModel(UnityMenuModel* model)
60
58
{
61
59
    if (m_model != model) {
62
 
        if (!model) {
63
 
            unregisterAction();
64
 
        }
 
60
        unregisterAction();
65
61
        m_model = model;
66
62
        registerAction();
67
63
        Q_EMIT modelChanged(model);
107
103
    }
108
104
}
109
105
 
110
 
int UnityMenuAction::index() const 
 
106
int UnityMenuAction::index() const
111
107
{
112
108
    return m_index;
113
109
}