Merge lp:~raof/mir/display-changer-callback-lifetime into lp:mir
- display-changer-callback-lifetime
- Merge into development-branch
Status: | Rejected |
---|---|
Rejected by: | Alan Griffiths |
Proposed branch: | lp:~raof/mir/display-changer-callback-lifetime |
Merge into: | lp:mir |
Diff against target: |
375 lines (+118/-104) 8 files modified
include/server/mir/scene/session_coordinator.h (+0/-2) src/server/scene/default_configuration.cpp (+1/-2) src/server/scene/mediating_display_changer.cpp (+97/-34) src/server/scene/mediating_display_changer.h (+11/-1) src/server/scene/session_manager.cpp (+0/-10) src/server/scene/session_manager.h (+0/-3) tests/unit-tests/scene/test_mediating_display_changer.cpp (+9/-9) tests/unit-tests/scene/test_session_manager.cpp (+0/-43) |
To merge this branch: | bzr merge lp:~raof/mir/display-changer-callback-lifetime |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mir CI Bot | continuous-integration | Approve | |
Alan Griffiths | Needs Information | ||
Chris Halse Rogers | Needs Fixing | ||
Review via email: mp+329241@code.launchpad.net |
Commit message
ms::MediatingDi
MediatingDispla
Description of the change
Alan Griffiths (alan-griffiths) wrote : | # |
Oh, nasty! Unlike some other listener patterns we have the SessionEventHan
Is this approach the best approach to resolving the problem this causes?
Mir CI Bot (mir-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:4232
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Alan Griffiths (alan-griffiths) wrote : | # |
- void add_listener(
- void remove_
-
I guess this is an unrelated deletion of dead code?
Chris Halse Rogers (raof) wrote : | # |
It's (hopefully) the most expedient. I also have a branch with much of the changes required to switch to a more classical observe with MultiplexingObs
This was less effort. It, at least, would be, if it didn't mysteriously die under load.
Alan Griffiths (alan-griffiths) wrote : | # |
> It's (hopefully) the most expedient. I also have a branch with much of the
> changes required to switch to a more classical observe with
> MultiplexingObs
>
> This was less effort. It, at least, would be, if it didn't mysteriously die
> under load.
Well, using BasicObservers<> seems to both simplify the code and address the end-of-life issues:
lp:~alan-griffiths/mir/rework-BroadcastingSessionEventSink/+merge/329255
Alan Griffiths (alan-griffiths) wrote : | # |
We landed an alternative
Unmerged revisions
- 4232. By Chris Halse Rogers
-
ms::MediatingDi
splayChanger: Ensure we live at least as long as our signal handlers. MediatingDispla
yChanger registers some handlers on the session_ event_handler_ register;
these need to ensure that the display changer is actually live before invoking methods on
it. - 4231. By Chris Halse Rogers
-
ms::SessionCoor
dinator: Remove {add,remove} _listener methods. These methods are used only by the tests which check their behaviour.
Sigh.
Preview Diff
1 | === modified file 'include/server/mir/scene/session_coordinator.h' | |||
2 | --- include/server/mir/scene/session_coordinator.h 2017-07-28 17:00:43 +0000 | |||
3 | +++ include/server/mir/scene/session_coordinator.h 2017-08-18 08:06:31 +0000 | |||
4 | @@ -54,8 +54,6 @@ | |||
5 | 54 | 54 | ||
6 | 55 | virtual std::shared_ptr<Session> successor_of(std::shared_ptr<Session> const&) const = 0; | 55 | virtual std::shared_ptr<Session> successor_of(std::shared_ptr<Session> const&) const = 0; |
7 | 56 | 56 | ||
8 | 57 | virtual void add_listener(std::shared_ptr<SessionListener> const&) = 0; | ||
9 | 58 | virtual void remove_listener(std::shared_ptr<SessionListener> const&) = 0; | ||
10 | 59 | protected: | 57 | protected: |
11 | 60 | SessionCoordinator() = default; | 58 | SessionCoordinator() = default; |
12 | 61 | virtual ~SessionCoordinator() = default; | 59 | virtual ~SessionCoordinator() = default; |
13 | 62 | 60 | ||
14 | === modified file 'src/server/scene/default_configuration.cpp' | |||
15 | --- src/server/scene/default_configuration.cpp 2017-07-28 17:00:43 +0000 | |||
16 | +++ src/server/scene/default_configuration.cpp 2017-08-18 08:06:31 +0000 | |||
17 | @@ -132,7 +132,7 @@ | |||
18 | 132 | return mediating_display_changer( | 132 | return mediating_display_changer( |
19 | 133 | [this]() | 133 | [this]() |
20 | 134 | { | 134 | { |
22 | 135 | return std::make_shared<ms::MediatingDisplayChanger>( | 135 | return ms::MediatingDisplayChanger::create( |
23 | 136 | the_display(), | 136 | the_display(), |
24 | 137 | the_compositor(), | 137 | the_compositor(), |
25 | 138 | the_display_configuration_policy(), | 138 | the_display_configuration_policy(), |
26 | @@ -142,7 +142,6 @@ | |||
27 | 142 | the_display_configuration_observer(), | 142 | the_display_configuration_observer(), |
28 | 143 | the_main_loop()); | 143 | the_main_loop()); |
29 | 144 | }); | 144 | }); |
30 | 145 | |||
31 | 146 | } | 145 | } |
32 | 147 | 146 | ||
33 | 148 | std::shared_ptr<mf::DisplayChanger> | 147 | std::shared_ptr<mf::DisplayChanger> |
34 | 149 | 148 | ||
35 | === modified file 'src/server/scene/mediating_display_changer.cpp' | |||
36 | --- src/server/scene/mediating_display_changer.cpp 2017-08-09 15:03:31 +0000 | |||
37 | +++ src/server/scene/mediating_display_changer.cpp 2017-08-18 08:06:31 +0000 | |||
38 | @@ -124,6 +124,103 @@ | |||
39 | 124 | }; | 124 | }; |
40 | 125 | } | 125 | } |
41 | 126 | 126 | ||
42 | 127 | std::shared_ptr<ms::MediatingDisplayChanger> ms::MediatingDisplayChanger::create( | ||
43 | 128 | std::shared_ptr<mg::Display> const& display, | ||
44 | 129 | std::shared_ptr<mc::Compositor> const& compositor, | ||
45 | 130 | std::shared_ptr<mg::DisplayConfigurationPolicy> const& display_configuration_policy, | ||
46 | 131 | std::shared_ptr<SessionContainer> const& session_container, | ||
47 | 132 | std::shared_ptr<SessionEventHandlerRegister> const& session_event_handler_register, | ||
48 | 133 | std::shared_ptr<ServerActionQueue> const& server_action_queue, | ||
49 | 134 | std::shared_ptr<mg::DisplayConfigurationObserver> const& observer, | ||
50 | 135 | std::shared_ptr<mt::AlarmFactory> const& alarm_factory) | ||
51 | 136 | { | ||
52 | 137 | std::shared_ptr<ms::MediatingDisplayChanger> const result{ | ||
53 | 138 | new ms::MediatingDisplayChanger{ | ||
54 | 139 | display, | ||
55 | 140 | compositor, | ||
56 | 141 | display_configuration_policy, | ||
57 | 142 | session_container, | ||
58 | 143 | session_event_handler_register, | ||
59 | 144 | server_action_queue, | ||
60 | 145 | observer, | ||
61 | 146 | alarm_factory | ||
62 | 147 | }}; | ||
63 | 148 | |||
64 | 149 | std::weak_ptr<ms::MediatingDisplayChanger> const weak_changer = result; | ||
65 | 150 | |||
66 | 151 | /* | ||
67 | 152 | * Caution! Reference cycle! | ||
68 | 153 | * | ||
69 | 154 | * result owns a reference to session_event_handler_register; | ||
70 | 155 | * if we capture a strong reference in the handler, then | ||
71 | 156 | * session_Event_handler_register will have a strong reference to | ||
72 | 157 | * result. | ||
73 | 158 | */ | ||
74 | 159 | session_event_handler_register->register_focus_change_handler( | ||
75 | 160 | [weak_changer](std::shared_ptr<ms::Session> const& session) | ||
76 | 161 | { | ||
77 | 162 | auto const weak_session = std::weak_ptr<ms::Session>(session); | ||
78 | 163 | if (auto const changer = weak_changer.lock()) | ||
79 | 164 | { | ||
80 | 165 | /* | ||
81 | 166 | * Caution! Bonus reference cycle! | ||
82 | 167 | * | ||
83 | 168 | * As before, changer owns a reference to server_action_queue. | ||
84 | 169 | */ | ||
85 | 170 | changer->server_action_queue->enqueue( | ||
86 | 171 | changer.get(), | ||
87 | 172 | [weak_changer, weak_session] | ||
88 | 173 | { | ||
89 | 174 | if (auto const changer = weak_changer.lock()) | ||
90 | 175 | { | ||
91 | 176 | if (auto const session = weak_session.lock()) | ||
92 | 177 | { | ||
93 | 178 | changer->focus_change_handler(session); | ||
94 | 179 | } | ||
95 | 180 | } | ||
96 | 181 | }); | ||
97 | 182 | } | ||
98 | 183 | }); | ||
99 | 184 | |||
100 | 185 | session_event_handler_register->register_no_focus_handler( | ||
101 | 186 | [weak_changer] | ||
102 | 187 | { | ||
103 | 188 | if (auto const changer = weak_changer.lock()) | ||
104 | 189 | { | ||
105 | 190 | changer->server_action_queue->enqueue( | ||
106 | 191 | changer.get(), | ||
107 | 192 | [weak_changer] | ||
108 | 193 | { | ||
109 | 194 | if (auto const changer = weak_changer.lock()) | ||
110 | 195 | { | ||
111 | 196 | changer->no_focus_handler(); | ||
112 | 197 | } | ||
113 | 198 | }); | ||
114 | 199 | } | ||
115 | 200 | }); | ||
116 | 201 | |||
117 | 202 | session_event_handler_register->register_session_stopping_handler( | ||
118 | 203 | [weak_changer](std::shared_ptr<ms::Session> const& session) | ||
119 | 204 | { | ||
120 | 205 | auto const weak_session = std::weak_ptr<ms::Session>(session); | ||
121 | 206 | if (auto const changer = weak_changer.lock()) | ||
122 | 207 | { | ||
123 | 208 | changer->server_action_queue->enqueue( | ||
124 | 209 | changer.get(), | ||
125 | 210 | [weak_changer,weak_session] | ||
126 | 211 | { | ||
127 | 212 | if (auto const changer = weak_changer.lock()) | ||
128 | 213 | { | ||
129 | 214 | if (auto const session = weak_session.lock()) | ||
130 | 215 | changer->session_stopping_handler(session); | ||
131 | 216 | } | ||
132 | 217 | }); | ||
133 | 218 | } | ||
134 | 219 | }); | ||
135 | 220 | |||
136 | 221 | return result; | ||
137 | 222 | } | ||
138 | 223 | |||
139 | 127 | ms::MediatingDisplayChanger::MediatingDisplayChanger( | 224 | ms::MediatingDisplayChanger::MediatingDisplayChanger( |
140 | 128 | std::shared_ptr<mg::Display> const& display, | 225 | std::shared_ptr<mg::Display> const& display, |
141 | 129 | std::shared_ptr<mc::Compositor> const& compositor, | 226 | std::shared_ptr<mc::Compositor> const& compositor, |
142 | @@ -144,40 +241,6 @@ | |||
143 | 144 | base_configuration_applied{true}, | 241 | base_configuration_applied{true}, |
144 | 145 | alarm_factory{alarm_factory} | 242 | alarm_factory{alarm_factory} |
145 | 146 | { | 243 | { |
146 | 147 | session_event_handler_register->register_focus_change_handler( | ||
147 | 148 | [this](std::shared_ptr<ms::Session> const& session) | ||
148 | 149 | { | ||
149 | 150 | auto const weak_session = std::weak_ptr<ms::Session>(session); | ||
150 | 151 | this->server_action_queue->enqueue( | ||
151 | 152 | this, | ||
152 | 153 | [this,weak_session] | ||
153 | 154 | { | ||
154 | 155 | if (auto const session = weak_session.lock()) | ||
155 | 156 | focus_change_handler(session); | ||
156 | 157 | }); | ||
157 | 158 | }); | ||
158 | 159 | |||
159 | 160 | session_event_handler_register->register_no_focus_handler( | ||
160 | 161 | [this] | ||
161 | 162 | { | ||
162 | 163 | this->server_action_queue->enqueue( | ||
163 | 164 | this, | ||
164 | 165 | [this] { no_focus_handler(); }); | ||
165 | 166 | }); | ||
166 | 167 | |||
167 | 168 | session_event_handler_register->register_session_stopping_handler( | ||
168 | 169 | [this](std::shared_ptr<ms::Session> const& session) | ||
169 | 170 | { | ||
170 | 171 | auto const weak_session = std::weak_ptr<ms::Session>(session); | ||
171 | 172 | this->server_action_queue->enqueue( | ||
172 | 173 | this, | ||
173 | 174 | [this,weak_session] | ||
174 | 175 | { | ||
175 | 176 | if (auto const session = weak_session.lock()) | ||
176 | 177 | session_stopping_handler(session); | ||
177 | 178 | }); | ||
178 | 179 | }); | ||
179 | 180 | |||
180 | 181 | observer->initial_configuration(base_configuration_); | 244 | observer->initial_configuration(base_configuration_); |
181 | 182 | } | 245 | } |
182 | 183 | 246 | ||
183 | 184 | 247 | ||
184 | === modified file 'src/server/scene/mediating_display_changer.h' | |||
185 | --- src/server/scene/mediating_display_changer.h 2017-07-28 17:00:43 +0000 | |||
186 | +++ src/server/scene/mediating_display_changer.h 2017-08-18 08:06:31 +0000 | |||
187 | @@ -55,7 +55,7 @@ | |||
188 | 55 | public shell::DisplayConfigurationController | 55 | public shell::DisplayConfigurationController |
189 | 56 | { | 56 | { |
190 | 57 | public: | 57 | public: |
192 | 58 | MediatingDisplayChanger( | 58 | static std::shared_ptr<MediatingDisplayChanger> create( |
193 | 59 | std::shared_ptr<graphics::Display> const& display, | 59 | std::shared_ptr<graphics::Display> const& display, |
194 | 60 | std::shared_ptr<compositor::Compositor> const& compositor, | 60 | std::shared_ptr<compositor::Compositor> const& compositor, |
195 | 61 | std::shared_ptr<graphics::DisplayConfigurationPolicy> const& display_configuration_policy, | 61 | std::shared_ptr<graphics::DisplayConfigurationPolicy> const& display_configuration_policy, |
196 | @@ -92,6 +92,16 @@ | |||
197 | 92 | void set_base_configuration(std::shared_ptr<graphics::DisplayConfiguration> const &conf) override; | 92 | void set_base_configuration(std::shared_ptr<graphics::DisplayConfiguration> const &conf) override; |
198 | 93 | 93 | ||
199 | 94 | private: | 94 | private: |
200 | 95 | MediatingDisplayChanger( | ||
201 | 96 | std::shared_ptr<graphics::Display> const& display, | ||
202 | 97 | std::shared_ptr<compositor::Compositor> const& compositor, | ||
203 | 98 | std::shared_ptr<graphics::DisplayConfigurationPolicy> const& display_configuration_policy, | ||
204 | 99 | std::shared_ptr<SessionContainer> const& session_container, | ||
205 | 100 | std::shared_ptr<SessionEventHandlerRegister> const& session_event_handler_register, | ||
206 | 101 | std::shared_ptr<ServerActionQueue> const& server_action_queue, | ||
207 | 102 | std::shared_ptr<graphics::DisplayConfigurationObserver> const& observer, | ||
208 | 103 | std::shared_ptr<time::AlarmFactory> const& alarm_factory); | ||
209 | 104 | |||
210 | 95 | void focus_change_handler(std::shared_ptr<Session> const& session); | 105 | void focus_change_handler(std::shared_ptr<Session> const& session); |
211 | 96 | void no_focus_handler(); | 106 | void no_focus_handler(); |
212 | 97 | void session_stopping_handler(std::shared_ptr<Session> const& session); | 107 | void session_stopping_handler(std::shared_ptr<Session> const& session); |
213 | 98 | 108 | ||
214 | === modified file 'src/server/scene/session_manager.cpp' | |||
215 | --- src/server/scene/session_manager.cpp 2017-07-28 17:00:43 +0000 | |||
216 | +++ src/server/scene/session_manager.cpp 2017-08-18 08:06:31 +0000 | |||
217 | @@ -186,13 +186,3 @@ | |||
218 | 186 | { | 186 | { |
219 | 187 | return app_container->successor_of(session); | 187 | return app_container->successor_of(session); |
220 | 188 | } | 188 | } |
221 | 189 | |||
222 | 190 | void ms::SessionManager::add_listener(std::shared_ptr<SessionListener> const& listener) | ||
223 | 191 | { | ||
224 | 192 | observers->register_interest(listener); | ||
225 | 193 | } | ||
226 | 194 | |||
227 | 195 | void ms::SessionManager::remove_listener(std::shared_ptr<SessionListener> const& listener) | ||
228 | 196 | { | ||
229 | 197 | observers->unregister_interest(*listener); | ||
230 | 198 | } | ||
231 | 199 | 189 | ||
232 | === modified file 'src/server/scene/session_manager.h' | |||
233 | --- src/server/scene/session_manager.h 2017-07-28 17:00:43 +0000 | |||
234 | +++ src/server/scene/session_manager.h 2017-08-18 08:06:31 +0000 | |||
235 | @@ -77,9 +77,6 @@ | |||
236 | 77 | void set_focus_to(std::shared_ptr<Session> const& focus) override; | 77 | void set_focus_to(std::shared_ptr<Session> const& focus) override; |
237 | 78 | void unset_focus() override; | 78 | void unset_focus() override; |
238 | 79 | 79 | ||
239 | 80 | void add_listener(std::shared_ptr<SessionListener> const& listener) override; | ||
240 | 81 | void remove_listener(std::shared_ptr<SessionListener> const& listener) override; | ||
241 | 82 | |||
242 | 83 | protected: | 80 | protected: |
243 | 84 | SessionManager(const SessionManager&) = delete; | 81 | SessionManager(const SessionManager&) = delete; |
244 | 85 | SessionManager& operator=(const SessionManager&) = delete; | 82 | SessionManager& operator=(const SessionManager&) = delete; |
245 | 86 | 83 | ||
246 | === modified file 'tests/unit-tests/scene/test_mediating_display_changer.cpp' | |||
247 | --- tests/unit-tests/scene/test_mediating_display_changer.cpp 2017-08-09 11:30:59 +0000 | |||
248 | +++ tests/unit-tests/scene/test_mediating_display_changer.cpp 2017-08-18 08:06:31 +0000 | |||
249 | @@ -140,7 +140,7 @@ | |||
250 | 140 | { | 140 | { |
251 | 141 | using namespace testing; | 141 | using namespace testing; |
252 | 142 | 142 | ||
254 | 143 | changer = std::make_shared<ms::MediatingDisplayChanger>( | 143 | changer = ms::MediatingDisplayChanger::create( |
255 | 144 | mt::fake_shared(mock_display), | 144 | mt::fake_shared(mock_display), |
256 | 145 | mt::fake_shared(mock_compositor), | 145 | mt::fake_shared(mock_compositor), |
257 | 146 | mt::fake_shared(mock_conf_policy), | 146 | mt::fake_shared(mock_conf_policy), |
258 | @@ -688,7 +688,7 @@ | |||
259 | 688 | stub_session_container.insert_session(session1); | 688 | stub_session_container.insert_session(session1); |
260 | 689 | stub_session_container.insert_session(session2); | 689 | stub_session_container.insert_session(session2); |
261 | 690 | 690 | ||
263 | 691 | ms::MediatingDisplayChanger display_changer( | 691 | auto display_changer = ms::MediatingDisplayChanger::create( |
264 | 692 | mt::fake_shared(mock_display), | 692 | mt::fake_shared(mock_display), |
265 | 693 | mt::fake_shared(mock_compositor), | 693 | mt::fake_shared(mock_compositor), |
266 | 694 | mt::fake_shared(mock_conf_policy), | 694 | mt::fake_shared(mock_conf_policy), |
267 | @@ -706,11 +706,11 @@ | |||
268 | 706 | Mock::VerifyAndClearExpectations(&mock_server_action_queue); | 706 | Mock::VerifyAndClearExpectations(&mock_server_action_queue); |
269 | 707 | 707 | ||
270 | 708 | EXPECT_CALL(mock_server_action_queue, enqueue(owner, _)); | 708 | EXPECT_CALL(mock_server_action_queue, enqueue(owner, _)); |
272 | 709 | display_changer.configure(session1, conf); | 709 | display_changer->configure(session1, conf); |
273 | 710 | Mock::VerifyAndClearExpectations(&mock_server_action_queue); | 710 | Mock::VerifyAndClearExpectations(&mock_server_action_queue); |
274 | 711 | 711 | ||
275 | 712 | EXPECT_CALL(mock_server_action_queue, enqueue(owner, _)); | 712 | EXPECT_CALL(mock_server_action_queue, enqueue(owner, _)); |
277 | 713 | display_changer.configure_for_hardware_change(conf); | 713 | display_changer->configure_for_hardware_change(conf); |
278 | 714 | Mock::VerifyAndClearExpectations(&mock_server_action_queue); | 714 | Mock::VerifyAndClearExpectations(&mock_server_action_queue); |
279 | 715 | 715 | ||
280 | 716 | EXPECT_CALL(mock_server_action_queue, enqueue(owner, _)); | 716 | EXPECT_CALL(mock_server_action_queue, enqueue(owner, _)); |
281 | @@ -722,11 +722,11 @@ | |||
282 | 722 | Mock::VerifyAndClearExpectations(&mock_server_action_queue); | 722 | Mock::VerifyAndClearExpectations(&mock_server_action_queue); |
283 | 723 | 723 | ||
284 | 724 | EXPECT_CALL(mock_server_action_queue, pause_processing_for(owner)); | 724 | EXPECT_CALL(mock_server_action_queue, pause_processing_for(owner)); |
286 | 725 | display_changer.pause_display_config_processing(); | 725 | display_changer->pause_display_config_processing(); |
287 | 726 | Mock::VerifyAndClearExpectations(&mock_server_action_queue); | 726 | Mock::VerifyAndClearExpectations(&mock_server_action_queue); |
288 | 727 | 727 | ||
289 | 728 | EXPECT_CALL(mock_server_action_queue, resume_processing_for(owner)); | 728 | EXPECT_CALL(mock_server_action_queue, resume_processing_for(owner)); |
291 | 729 | display_changer.resume_display_config_processing(); | 729 | display_changer->resume_display_config_processing(); |
292 | 730 | Mock::VerifyAndClearExpectations(&mock_server_action_queue); | 730 | Mock::VerifyAndClearExpectations(&mock_server_action_queue); |
293 | 731 | } | 731 | } |
294 | 732 | 732 | ||
295 | @@ -742,7 +742,7 @@ | |||
296 | 742 | stub_session_container.insert_session(active_session); | 742 | stub_session_container.insert_session(active_session); |
297 | 743 | stub_session_container.insert_session(inactive_session); | 743 | stub_session_container.insert_session(inactive_session); |
298 | 744 | 744 | ||
300 | 745 | ms::MediatingDisplayChanger display_changer( | 745 | auto display_changer = ms::MediatingDisplayChanger::create( |
301 | 746 | mt::fake_shared(mock_display), | 746 | mt::fake_shared(mock_display), |
302 | 747 | mt::fake_shared(mock_compositor), | 747 | mt::fake_shared(mock_compositor), |
303 | 748 | mt::fake_shared(mock_conf_policy), | 748 | mt::fake_shared(mock_conf_policy), |
304 | @@ -758,7 +758,7 @@ | |||
305 | 758 | 758 | ||
306 | 759 | EXPECT_CALL(mock_server_action_queue, enqueue(_, _)).Times(0); | 759 | EXPECT_CALL(mock_server_action_queue, enqueue(_, _)).Times(0); |
307 | 760 | 760 | ||
309 | 761 | display_changer.configure(inactive_session, conf); | 761 | display_changer->configure(inactive_session, conf); |
310 | 762 | } | 762 | } |
311 | 763 | 763 | ||
312 | 764 | TEST_F(MediatingDisplayChangerTest, set_base_configuration_doesnt_override_session_configuration) | 764 | TEST_F(MediatingDisplayChangerTest, set_base_configuration_doesnt_override_session_configuration) |
313 | @@ -871,7 +871,7 @@ | |||
314 | 871 | MOCK_METHOD1(base_configuration_updated, void (std::shared_ptr<mg::DisplayConfiguration const> const& base_config)); | 871 | MOCK_METHOD1(base_configuration_updated, void (std::shared_ptr<mg::DisplayConfiguration const> const& base_config)); |
315 | 872 | } display_configuration_observer; | 872 | } display_configuration_observer; |
316 | 873 | 873 | ||
318 | 874 | changer = std::make_shared<ms::MediatingDisplayChanger>( | 874 | changer = ms::MediatingDisplayChanger::create( |
319 | 875 | mt::fake_shared(mock_display), | 875 | mt::fake_shared(mock_display), |
320 | 876 | mt::fake_shared(mock_compositor), | 876 | mt::fake_shared(mock_compositor), |
321 | 877 | mt::fake_shared(mock_conf_policy), | 877 | mt::fake_shared(mock_conf_policy), |
322 | 878 | 878 | ||
323 | === modified file 'tests/unit-tests/scene/test_session_manager.cpp' | |||
324 | --- tests/unit-tests/scene/test_session_manager.cpp 2017-07-28 17:00:43 +0000 | |||
325 | +++ tests/unit-tests/scene/test_session_manager.cpp 2017-08-18 08:06:31 +0000 | |||
326 | @@ -184,49 +184,6 @@ | |||
327 | 184 | session_manager.close_session(session); | 184 | session_manager.close_session(session); |
328 | 185 | } | 185 | } |
329 | 186 | 186 | ||
330 | 187 | TEST_F(SessionManagerSessionListenerSetup, additional_listeners_receive_session_callbacks) | ||
331 | 188 | { | ||
332 | 189 | using namespace ::testing; | ||
333 | 190 | |||
334 | 191 | auto additional_listener = std::make_shared<testing::NiceMock<mtd::MockSessionListener>>(); | ||
335 | 192 | EXPECT_CALL(*additional_listener, starting(_)).Times(1); | ||
336 | 193 | EXPECT_CALL(*additional_listener, stopping(_)).Times(1); | ||
337 | 194 | |||
338 | 195 | session_manager.add_listener(additional_listener); | ||
339 | 196 | auto session = session_manager.open_session(__LINE__, "XPlane", std::shared_ptr<mf::EventSink>()); | ||
340 | 197 | session_manager.close_session(session); | ||
341 | 198 | } | ||
342 | 199 | |||
343 | 200 | TEST_F(SessionManagerSessionListenerSetup, additional_listeners_receive_focus_changes) | ||
344 | 201 | { | ||
345 | 202 | using namespace ::testing; | ||
346 | 203 | |||
347 | 204 | auto additional_listener = std::make_shared<testing::NiceMock<mtd::MockSessionListener>>(); | ||
348 | 205 | EXPECT_CALL(*additional_listener, starting(_)).Times(1); | ||
349 | 206 | EXPECT_CALL(*additional_listener, focused(_)).Times(1); | ||
350 | 207 | EXPECT_CALL(*additional_listener, unfocused()).Times(1); | ||
351 | 208 | |||
352 | 209 | session_manager.add_listener(additional_listener); | ||
353 | 210 | auto session = session_manager.open_session(__LINE__, "XPlane", std::shared_ptr<mf::EventSink>()); | ||
354 | 211 | session_manager.set_focus_to(session); | ||
355 | 212 | session_manager.unset_focus(); | ||
356 | 213 | } | ||
357 | 214 | |||
358 | 215 | TEST_F(SessionManagerSessionListenerSetup, additional_listeners_receive_surface_creation) | ||
359 | 216 | { | ||
360 | 217 | using namespace ::testing; | ||
361 | 218 | mtd::NullEventSink event_sink; | ||
362 | 219 | auto additional_listener = std::make_shared<testing::NiceMock<mtd::MockSessionListener>>(); | ||
363 | 220 | EXPECT_CALL(*additional_listener, starting(_)).Times(1); | ||
364 | 221 | EXPECT_CALL(*additional_listener, surface_created(_,_)).Times(1); | ||
365 | 222 | |||
366 | 223 | session_manager.add_listener(additional_listener); | ||
367 | 224 | auto session = session_manager.open_session(__LINE__, "XPlane", std::shared_ptr<mf::EventSink>()); | ||
368 | 225 | auto bs = session->create_buffer_stream( | ||
369 | 226 | mg::BufferProperties{{640, 480}, mir_pixel_format_abgr_8888, mg::BufferUsage::hardware}); | ||
370 | 227 | session->create_surface(ms::SurfaceCreationParameters().with_buffer_stream(bs), mt::fake_shared(event_sink)); | ||
371 | 228 | } | ||
372 | 229 | |||
373 | 230 | namespace | 187 | namespace |
374 | 231 | { | 188 | { |
375 | 232 | struct SessionManagerSessionEventsSetup : public testing::Test | 189 | struct SessionManagerSessionEventsSetup : public testing::Test |
For some reason which is absolutely opaque to me this appears to cause the testsuite to crash with an invalid read from 0x0 when *exiting* from ConnectedClient WithASurface: :SetUp( ), when run under Valgrind and under load.