blob: 6ec937cf5dc7ae887938e8e62b2ad211fa5d16e1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
@@ -, +, @@
author: Alex Rousskov <rousskov@measurement-factory.com>
Avoid on-exit crashes when adaptation is enabled.
After trunk r13269 (Vector refactor) destroyed vector objects still have
positive item counts. This exposes use-after-delete bugs. In this particular
case, global adaptation rule/group/service arrays are destructed by global
destruction sequence first and then again by Adaptation::*::TheConfig objects
destructors.
This change avoiding static destruction order dependencies by storing those
global adaptation arrays on heap.
--- src/adaptation/AccessRule.cc 2014-06-03 07:05:07 +0000
+++ src/adaptation/AccessRule.cc 2014-06-29 15:22:19 +0000
@@ -51,10 +51,10 @@ Adaptation::AccessRule::group()
Adaptation::AccessRules &
Adaptation::AllRules()
{
- static AccessRules TheRules;
- return TheRules;
+ static AccessRules *TheRules = new AccessRules;
+ return *TheRules;
}
// TODO: make AccessRules::find work
Adaptation::AccessRule *
--- src/adaptation/Service.cc 2012-08-28 13:00:30 +0000
+++ src/adaptation/Service.cc 2014-06-29 15:22:19 +0000
@@ -53,10 +53,10 @@ Adaptation::Service::wants(const Service
Adaptation::Services &
Adaptation::AllServices()
{
- static Services TheServices;
- return TheServices;
+ static Services *TheServices = new Services;
+ return *TheServices;
}
Adaptation::ServicePointer
Adaptation::FindService(const Service::Id& key)
--- src/adaptation/ServiceGroups.cc 2013-09-28 13:03:58 +0000
+++ src/adaptation/ServiceGroups.cc 2014-06-29 15:22:19 +0000
@@ -314,10 +314,10 @@ Adaptation::ServicePlan::print(std::ostr
Adaptation::Groups &
Adaptation::AllGroups()
{
- static Groups TheGroups;
- return TheGroups;
+ static Groups *TheGroups = new Groups;
+ return *TheGroups;
}
Adaptation::ServiceGroupPointer
Adaptation::FindGroup(const ServiceGroup::Id &id)
|