Mir

Merge lp:~albaguirre/mir/fix-1473869 into lp:mir

Proposed by Alberto Aguirre
Status: Merged
Approved by: Alberto Aguirre
Approved revision: no longer in the source branch.
Merged at revision: 2755
Proposed branch: lp:~albaguirre/mir/fix-1473869
Merge into: lp:mir
Diff against target: 28 lines (+11/-3)
1 file modified
examples/server_example_test_client.cpp (+11/-3)
To merge this branch: bzr merge lp:~albaguirre/mir/fix-1473869
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Kevin DuBois (community) Approve
Cemil Azizoglu (community) Approve
Review via email: mp+265178@code.launchpad.net

Commit message

Workaround for static alarm objects which are destroyed after the server is destroyed.

Description of the change

Workaround for static alarm objects which are destroyed after the server is destroyed.

To post a comment you must log in.
Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

ok

review: Approve
Revision history for this message
Kevin DuBois (kdub) wrote :

hmm, lgtm as a workaround, although maybe we should file another lower-priority bug so we remember to fix the source of the problem with the glib loop

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/server_example_test_client.cpp'
2--- examples/server_example_test_client.cpp 2015-04-28 07:54:10 +0000
3+++ examples/server_example_test_client.cpp 2015-07-17 20:37:09 +0000
4@@ -107,14 +107,22 @@
5 }
6 else if (pid > 0)
7 {
8- static auto const kill_action = server.the_main_loop()->create_alarm(
9- [pid]{ kill(pid, SIGTERM); });
10+ //FIXME: These alarm objects outlive the server - their destructor is called after the server is destroyed.
11+ //The alarm destructor implementation reference glib objects that are assumed to exist which leads to crashes.
12+ //For now, as a workaround, canceling the alarm will release such internal resources
13+ static std::unique_ptr<mir::time::Alarm> const kill_action = server.the_main_loop()->create_alarm(
14+ [pid]
15+ {
16+ kill_action->cancel();
17+ kill(pid, SIGTERM);
18+ });
19
20- static auto const exit_action = server.the_main_loop()->create_alarm(
21+ static std::unique_ptr<mir::time::Alarm> const exit_action = server.the_main_loop()->create_alarm(
22 [pid, &server, &test_failed]
23 {
24 if (!exit_success(pid))
25 test_failed = true;
26+ exit_action->cancel();
27 server.stop();
28 });
29

Subscribers

People subscribed via source and target branches