mirror of
https://github.com/NixOS/nix.git
synced 2025-11-09 12:06:01 +01:00
Fix virtual method calls during construction in S3BinaryCacheStoreImpl
Move init() call from constructor to openStore() method to avoid calling virtual methods during object construction. This prevents undefined behavior when virtual methods are called before the object is fully constructed.
This commit is contained in:
parent
17c94ca89e
commit
f12f96bcbb
1 changed files with 3 additions and 3 deletions
|
|
@ -289,8 +289,6 @@ struct S3BinaryCacheStoreImpl : virtual S3BinaryCacheStore
|
|||
, s3Helper(config->profile, config->region, config->scheme, config->endpoint)
|
||||
{
|
||||
diskCache = getNarInfoDiskCache();
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
std::string getUri() override
|
||||
|
|
@ -597,10 +595,12 @@ struct S3BinaryCacheStoreImpl : virtual S3BinaryCacheStore
|
|||
|
||||
ref<Store> S3BinaryCacheStoreImpl::Config::openStore() const
|
||||
{
|
||||
return make_ref<S3BinaryCacheStoreImpl>(ref{
|
||||
auto store = make_ref<S3BinaryCacheStoreImpl>(ref{
|
||||
// FIXME we shouldn't actually need a mutable config
|
||||
std::const_pointer_cast<S3BinaryCacheStore::Config>(shared_from_this())
|
||||
});
|
||||
store->init();
|
||||
return store;
|
||||
}
|
||||
|
||||
static RegisterStoreImplementation<S3BinaryCacheStoreImpl::Config> regS3BinaryCacheStore;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue