on xenial help sign in
Respect pre-set import paths and prevent segfault in startShell.
5e90769Michał Sawicz
main.cpp+7−3
@@ -160,10 +160,14 @@ int startShell(int argc, const char** argv, void* server)
160 prependImportPaths(view->engine(), ::overrideImportPaths());
160 prependImportPaths(view->engine(), ::overrideImportPaths());
161 appendImportPaths(view->engine(), ::fallbackImportPaths());
161 appendImportPaths(view->engine(), ::fallbackImportPaths());
162
162
163− QStringList importPath = view->engine()->importPathList().filter("qt5/imports");
164 if (isUbuntuMirServer) {
163 if (isUbuntuMirServer) {
164+ QStringList importPath = view->engine()->importPathList().filter("qt5/imports");
165+ if (!importPath.isEmpty()) {
165− importPath.first().append("/Unity-Mir");
166+ importPath.first().append("/Unity-Mir");
166− view->engine()->addImportPath(importPath.first());
167+ view->engine()->addImportPath(importPath.first());
168+ } else {
169+ qDebug() << "unable to patch import path";
170+ }
167 }
171 }
168
172
169 view->setSource(source);
173 view->setSource(source);
tests/autopilot/unity8/shell/tests/__init__.py+10−4
@@ -183,10 +183,14 @@ class UnityTestCase(AutopilotTestCase):
183 def patch_lightdm_mock(self, mock_type='single'):
183 def patch_lightdm_mock(self, mock_type='single'):
184 self._lightdm_mock_type = mock_type
184 self._lightdm_mock_type = mock_type
185 logger.info("Setting up LightDM mock type '%s'", mock_type)
185 logger.info("Setting up LightDM mock type '%s'", mock_type)
186− new_ld_library_path = "%s:%s" % (
186+ new_ld_library_path = [
187 get_default_extra_mock_libraries(),
187 get_default_extra_mock_libraries(),
188 self._get_lightdm_mock_path(mock_type)
188 self._get_lightdm_mock_path(mock_type)
189− )
189+ ]
190+ if os.getenv('LD_LIBRARY_PATH') is not None:
191+ new_ld_library_path.insert(0, os.getenv('LD_LIBRARY_PATH'))
192+
193+ new_ld_library_path = ':'.join(new_ld_library_path)
190 logger.info("New library path: %s", new_ld_library_path)
194 logger.info("New library path: %s", new_ld_library_path)
191
195
192 self.patch_environment('LD_LIBRARY_PATH', new_ld_library_path)
196 self.patch_environment('LD_LIBRARY_PATH', new_ld_library_path)
@@ -205,8 +209,10 @@ class UnityTestCase(AutopilotTestCase):
205 return lightdm_mock_path
209 return lightdm_mock_path
206
210
207 def _setup_extra_mock_environment_patch(self):
211 def _setup_extra_mock_environment_patch(self):
208− mocks_library_path = get_mocks_library_path()
212+ qml_import_path = [get_mocks_library_path()]
213+ if os.getenv('QML2_IMPORT_PATH') is not None:
214+ qml_import_path.insert(0, os.getenv('QML2_IMPORT_PATH'))
209− self.patch_environment('QML2_IMPORT_PATH', mocks_library_path)
215+ self.patch_environment('QML2_IMPORT_PATH', ':'.join(mocks_library_path))
210
216
211 def _set_proxy(self, proxy):
217 def _set_proxy(self, proxy):
212 """Keep a copy of the proxy object, so we can use it to get common
218 """Keep a copy of the proxy object, so we can use it to get common