Skip to content

Commit 4c95086

Browse files
authored
Merge pull request #13493 from Mic92/clang-tidy-virtual-methods
Fix virtual method calls during construction
2 parents 32a11a6 + 44963da commit 4c95086

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/libstore/local-binary-cache-store.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ struct LocalBinaryCacheStore :
3939
, BinaryCacheStore{*config}
4040
, config{config}
4141
{
42-
init();
4342
}
4443

4544
void init() override;
@@ -126,10 +125,12 @@ StringSet LocalBinaryCacheStoreConfig::uriSchemes()
126125
}
127126

128127
ref<Store> LocalBinaryCacheStoreConfig::openStore() const {
129-
return make_ref<LocalBinaryCacheStore>(ref{
128+
auto store = make_ref<LocalBinaryCacheStore>(ref{
130129
// FIXME we shouldn't actually need a mutable config
131130
std::const_pointer_cast<LocalBinaryCacheStore::Config>(shared_from_this())
132131
});
132+
store->init();
133+
return store;
133134
}
134135

135136
static RegisterStoreImplementation<LocalBinaryCacheStore::Config> regLocalBinaryCacheStore;

src/libstore/s3-binary-cache-store.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,6 @@ struct S3BinaryCacheStoreImpl : virtual S3BinaryCacheStore
289289
, s3Helper(config->profile, config->region, config->scheme, config->endpoint)
290290
{
291291
diskCache = getNarInfoDiskCache();
292-
293-
init();
294292
}
295293

296294
std::string getUri() override
@@ -597,10 +595,12 @@ struct S3BinaryCacheStoreImpl : virtual S3BinaryCacheStore
597595

598596
ref<Store> S3BinaryCacheStoreImpl::Config::openStore() const
599597
{
600-
return make_ref<S3BinaryCacheStoreImpl>(ref{
598+
auto store = make_ref<S3BinaryCacheStoreImpl>(ref{
601599
// FIXME we shouldn't actually need a mutable config
602600
std::const_pointer_cast<S3BinaryCacheStore::Config>(shared_from_this())
603601
});
602+
store->init();
603+
return store;
604604
}
605605

606606
static RegisterStoreImplementation<S3BinaryCacheStoreImpl::Config> regS3BinaryCacheStore;

0 commit comments

Comments
 (0)