Project

General

Profile

0001-Proposed-fix-for-issue-7006.patch

Per commit:5fc22fe - Christopher Green, 03/23/2015 01:27 PM

View differences:

art/Framework/Services/Registry/ServicesManager.cc
179 179
  factory_.insert(std::make_pair(iType,
180 180
                                 detail::ServiceCacheEntry(pset,
181 181
                                     std::move(helper),
182
                                     implEntry)));
182
                                     implEntry->second)));
183 183
}
184 184
// ======================================================================
art/Framework/Services/Registry/detail/ServiceCache.h
2 2
#define art_Framework_Services_Registry_detail_ServiceCache_h
3 3

  
4 4
#include "art/Utilities/TypeID.h"
5
#include "art/Framework/Services/Registry/detail/ServiceCacheEntry.h"
5 6

  
6 7
#include <map>
7 8

  
8 9
namespace art {
9 10
  namespace detail {
10
    class ServiceCacheEntry;
11 11

  
12 12
    typedef  std::map< TypeID, detail::ServiceCacheEntry >  ServiceCache;
13 13

  
art/Framework/Services/Registry/detail/ServiceCacheEntry.cc
6 6
#include "art/Framework/Services/Registry/detail/ServiceCacheEntry.h"
7 7

  
8 8
#include "art/Framework/Services/Registry/ServiceScope.h"
9
#include "art/Framework/Services/Registry/detail/ServiceCache.h"
10 9
#include "art/Framework/Services/Registry/detail/ServiceStack.h"
11 10
#include "art/Framework/Services/Registry/detail/ServiceWrapper.h"
12 11
#include "art/Framework/Services/Registry/detail/ServiceHelper.h"
......
26 25
  config_(pset),
27 26
  helper_(std::move(helper)),
28 27
  service_(),
29
  interface_impl_()
28
  interface_impl_(nullptr)
30 29
{
31 30
}
32 31

  
......
34 33
art::detail::ServiceCacheEntry::
35 34
ServiceCacheEntry(fhicl::ParameterSet const & pset,
36 35
                  std::unique_ptr<detail::ServiceHelperBase> && helper,
37
                  ServiceCache::iterator impl)
36
                  ServiceCacheEntry const & impl)
38 37
  :
39 38
  config_(pset),
40 39
  helper_(std::move(helper)),
41 40
  service_(),
42
  interface_impl_(impl)
41
  interface_impl_(&impl)
43 42
{
44 43
}
45 44

  
......
51 50
  config_(),
52 51
  helper_(std::move(helper)),
53 52
  service_(premade_service),
54
  interface_impl_()
53
  interface_impl_(nullptr)
55 54
{
56 55
}
57 56

  
......
64 63
  if (is_interface()) { // Service interface
65 64
    if (!service_) {
66 65
      // No cached instance, we need to make it.
67
      if (!interface_impl_->second.service_) {
68
        // The service provider has no cached instance, have it make one.
69
        interface_impl_->second.createService(reg, creationOrder);
70
      }
66
      interface_impl_->createService(reg, creationOrder);
71 67
      // Convert the service provider wrapper to a service interface wrapper,
72 68
      // and use that as our cached instance.
73
      interface_impl_->second.convertService(service_);
69
      interface_impl_->convertService(service_);
74 70
    }
75 71
  }
76 72
  else { // Concrete service.
art/Framework/Services/Registry/detail/ServiceCacheEntry.h
6 6
// Used by ServicesManager to handle creation and caching of services.
7 7

  
8 8
#include "art/Framework/Services/Registry/ServiceScope.h"
9
#include "art/Framework/Services/Registry/detail/ServiceCache.h"
10 9
#include "art/Framework/Services/Registry/detail/ServiceStack.h"
11 10
#include "art/Framework/Services/Registry/detail/ServiceHelper.h"
12 11
#include "cpp0x/memory"
......
34 33
  // Service interface implementation.
35 34
  ServiceCacheEntry(fhicl::ParameterSet const & pset,
36 35
                    std::unique_ptr<detail::ServiceHelperBase> && helper,
37
                    ServiceCache::iterator impl);
36
                    ServiceCacheEntry const & impl);
38 37

  
39 38
  // Pre-made service (1).
40 39
  ServiceCacheEntry(WrapperBase_ptr premade_service,
......
83 82
  fhicl::ParameterSet config_;
84 83
  std::unique_ptr<detail::ServiceHelperBase> helper_;
85 84
  mutable WrapperBase_ptr service_;
86
  ServiceCache::iterator const interface_impl_;
85
  ServiceCacheEntry const * const interface_impl_;
87 86
};  // ServiceCacheEntry
88 87

  
89 88
inline
90
-