~aacid/qtubuntu/remove_unused_signal

« back to all changes in this revision

Viewing changes to src/ubuntumirclient/integration.cpp

Quit gracefully if Mir connection failed (LP: #1655936)

Approved by: Daniel d'Andrada, Unity8 CI Bot

Show diffs side-by-side

added added

removed removed

Lines of Context:
96
96
    , mAppStateController(new UbuntuAppStateController)
97
97
    , mScaleFactor(1.0)
98
98
{
 
99
    QByteArray sessionName;
99
100
    {
100
101
        QStringList args = QCoreApplication::arguments();
101
102
        setupOptions(args);
102
 
        QByteArray sessionName = generateSessionName(args);
 
103
        sessionName = generateSessionName(args);
103
104
        setupDescription(sessionName);
104
105
    }
105
106
 
106
107
    // Create new application instance
107
108
    mInstance = u_application_instance_new_from_description_with_options(mDesc, mOptions);
108
109
 
109
 
    if (mInstance == nullptr)
110
 
        qFatal("UbuntuClientIntegration: connection to Mir server failed. Check that a Mir server is\n"
111
 
               "running, and the correct socket is being used and is accessible. The shell may have\n"
112
 
               "rejected the incoming connection, so check its log file");
 
110
    if (mInstance == nullptr) {
 
111
        qCritical("[QPA] UbuntuClientIntegration: connection to Mir server failed.\n");
 
112
 
 
113
        // TODO: add API to platform-api to fetch Mir's error message (bug:1655970).
 
114
        // Workaround by retrying the connection here in order to get the message.
 
115
        auto mirConnection = mir_connect_sync(nullptr, sessionName.data());
 
116
        qCritical("Mir returned: \"%s\"", mir_connection_get_error_message(mirConnection));
 
117
        mir_connection_release(mirConnection);
 
118
        exit(EXIT_FAILURE);
 
119
    }
113
120
 
114
121
    mMirConnection = u_application_instance_get_mir_connection(mInstance);
115
122