Merge lp:~mhr3/unity-scopes-shell/scopes-list-delay-envvar into lp:unity-scopes-shell

Proposed by Michal Hruby
Status: Merged
Approved by: Nick Dedekind
Approved revision: 35
Merged at revision: 35
Proposed branch: lp:~mhr3/unity-scopes-shell/scopes-list-delay-envvar
Merge into: lp:unity-scopes-shell
Diff against target: 63 lines (+11/-3)
4 files modified
cmake/modules/Plugins.cmake (+1/-1)
src/Unity/scopes-ng/scopes.cpp (+7/-1)
src/Unity/scopes-ng/scopes.h (+2/-0)
tests/CMakeLists.txt (+1/-1)
To merge this branch: bzr merge lp:~mhr3/unity-scopes-shell/scopes-list-delay-envvar
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Nick Dedekind (community) Approve
Review via email: mp+199840@code.launchpad.net

Commit message

Added environment variable that controls the scope thread delay.

Description of the change

Added environment variable that controls the scope thread delay.

This allows us to set the delay to a huge value when running qmlplugindump, which fixes a crash that can happen in it. It also allows us to lower the delay when running tests, so they run faster.

To post a comment you must log in.
Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

Looks horrible, but it'll do!

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cmake/modules/Plugins.cmake'
2--- cmake/modules/Plugins.cmake 2013-11-18 17:58:14 +0000
3+++ cmake/modules/Plugins.cmake 2013-12-20 16:53:57 +0000
4@@ -50,7 +50,7 @@
5 if(NOT CMAKE_CROSSCOMPILING)
6 # create the plugin.qmltypes file
7 add_custom_target(${PLUGIN}-qmltypes ALL
8- COMMAND ${qmlplugindump_exe} -notrelocatable ${PLUGIN} ${VERSION} ${CMAKE_CURRENT_BINARY_DIR}/../ > ${CMAKE_CURRENT_BINARY_DIR}/plugin.qmltypes
9+ COMMAND UNITY_SCOPES_LIST_DELAY=10000 ${qmlplugindump_exe} -notrelocatable ${PLUGIN} ${VERSION} ${CMAKE_CURRENT_BINARY_DIR}/../ > ${CMAKE_CURRENT_BINARY_DIR}/plugin.qmltypes
10 )
11 add_dependencies(${PLUGIN}-qmltypes ${PLUGIN}-qmlfiles ${qmlplugin_TARGETS})
12
13
14=== modified file 'src/Unity/scopes-ng/scopes.cpp'
15--- src/Unity/scopes-ng/scopes.cpp 2013-12-12 12:53:36 +0000
16+++ src/Unity/scopes-ng/scopes.cpp 2013-12-20 16:53:57 +0000
17@@ -68,6 +68,8 @@
18 return m_metadataMap;
19 }
20
21+int Scopes::LIST_DELAY = -1;
22+
23 Scopes::Scopes(QObject *parent)
24 : QAbstractListModel(parent)
25 , m_listThread(nullptr)
26@@ -80,7 +82,11 @@
27
28 // delaying spawning the worker thread, causes problems with qmlplugindump
29 // without it
30- QTimer::singleShot(100, this, SLOT(populateScopes()));
31+ if (LIST_DELAY < 0) {
32+ QByteArray listDelay = qgetenv("UNITY_SCOPES_LIST_DELAY");
33+ LIST_DELAY = listDelay.isNull() ? 100 : listDelay.toInt();
34+ }
35+ QTimer::singleShot(LIST_DELAY, this, SLOT(populateScopes()));
36 }
37
38 Scopes::~Scopes()
39
40=== modified file 'src/Unity/scopes-ng/scopes.h'
41--- src/Unity/scopes-ng/scopes.h 2013-12-10 16:46:46 +0000
42+++ src/Unity/scopes-ng/scopes.h 2013-12-20 16:53:57 +0000
43@@ -72,6 +72,8 @@
44 void discoveryFinished();
45
46 private:
47+ static int LIST_DELAY;
48+
49 QHash<int, QByteArray> m_roles;
50 QList<Scope*> m_scopes;
51 QThread* m_listThread;
52
53=== modified file 'tests/CMakeLists.txt'
54--- tests/CMakeLists.txt 2013-12-18 10:25:51 +0000
55+++ tests/CMakeLists.txt 2013-12-20 16:53:57 +0000
56@@ -35,7 +35,7 @@
57 add_executable(${_test}Exec ${_test}.cpp)
58 qt5_use_modules(${_test}Exec Test Core Qml)
59 set_tests_properties(test${CLASSNAME}${_test}
60- PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=minimal;LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/Unity:${LIBUNITYPROTO_LIBRARY_DIRS};UNITY_SCOPES_RUNTIME_PATH=${SCOPES_TEST_RUNTIME}")
61+ PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=minimal;LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/Unity:${LIBUNITYPROTO_LIBRARY_DIRS};UNITY_SCOPES_RUNTIME_PATH=${SCOPES_TEST_RUNTIME};UNITY_SCOPES_LIST_DELAY=5")
62 set_target_properties(${_test}Exec
63 PROPERTIES COMPILE_FLAGS "-DTEST_SCOPEREGISTRY_BIN='\"${SCOPES_BIN_DIR}/scoperegistry/scoperegistry\"' -DTEST_RUNTIME_CONFIG='\"${SCOPES_TEST_RUNTIME}\"'")
64

Subscribers

People subscribed via source and target branches

to all changes: