~marcustomlinson/unity-scopes-shell/lp-1583055

« back to all changes in this revision

Viewing changes to src/Unity/scopes.cpp

  • Committer: CI Train Bot
  • Author(s): Pawel Stolowski
  • Date: 2016-05-05 09:40:36 UTC
  • mfrom: (300.1.5 locale-fallback)
  • Revision ID: ci-train-bot@canonical.com-20160505094036-4rjmn8seo2t77oz4
Don't crash if scopes runtime cannot be initialized (e.g. when locale setup is broken).
Force LC_ALL when running tests to avoid occasional failures on our builders (locale issues). Fixes: #1363946
Approved by: Marcus Tomlinson

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
        auto registry = m_scopesRuntime->registry();
62
62
        m_metadataMap = registry->list();
63
63
    }
64
 
    catch (unity::Exception const& err)
 
64
    catch (std::exception const& err)
65
65
    {
66
 
        qWarning("ERROR! Caught %s", err.to_string().c_str());
 
66
        qWarning("ERROR! Caught %s", err.what());
67
67
    }
68
68
    Q_EMIT discoveryFinished();
69
69
}
280
280
    ScopeListWorker* thread = qobject_cast<ScopeListWorker*>(sender());
281
281
 
282
282
    m_scopesRuntime = thread->getRuntime();
 
283
 
 
284
    if (!m_scopesRuntime) {
 
285
        // This signifies a serious problem, such as a broken locale setup. We cannot recover from that.
 
286
        // Return early so that scope objects are not created etc. The Dash will remain blank.
 
287
        qWarning() << "FATAL ERROR! Scopes runtime couldn't be initialized. Please check your system settings and locale data/setup. The Dash will remain empty until the underlying problem is fixed.";
 
288
        m_loaded = true;
 
289
        Q_EMIT loadedChanged();
 
290
        return;
 
291
    }
 
292
 
283
293
    auto scopes = thread->metadataMap();
284
294
    m_priv->m_list_update_callback_connection_.reset(
285
295
            new core::ScopedConnection(