~mzanetti/unity8/modeswitchwarning

« back to all changes in this revision

Viewing changes to plugins/Utils/applicationsfiltermodel.cpp

  • Committer: Michael Zanetti
  • Date: 2015-11-05 13:39:47 UTC
  • Revision ID: michael.zanetti@canonical.com-20151105133947-at87n64ron6sdwwc
fix disconnect when changing the source model

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
 
38
38
void ApplicationsFilterModel::setApplicationsModel(ApplicationManagerInterface *applicationsModel)
39
39
{
40
 
    if (m_appModel) {
41
 
        disconnect(m_appModel, &ApplicationManagerInterface::countChanged, this, &ApplicationsFilterModel::countChanged);
42
 
    }
43
40
    if (m_appModel != applicationsModel) {
 
41
        if (m_appModel) {
 
42
            disconnect(m_appModel, &ApplicationManagerInterface::countChanged, this, &ApplicationsFilterModel::countChanged);
 
43
        }
44
44
        m_appModel = applicationsModel;
45
45
        setSourceModel(m_appModel);
46
46
        Q_EMIT applicationsModelChanged();