@@ -62,7 +62,8 @@ auto getXDPDocumentsMountPoint() noexcept -> utils::error::Result<std::filesyste
6262 return LINGLONG_ERR (" Documents portal mount point reply is empty" );
6363 }
6464
65- const auto &value = reply.arguments ().constFirst ();
65+ auto arguments = reply.arguments ();
66+ const auto &value = arguments.constFirst ();
6667 if (!value.canConvert <QByteArray>()) {
6768 return LINGLONG_ERR (
6869 fmt::format (" unexpected Documents portal mount point type: {}" , value.typeName ()));
@@ -306,7 +307,7 @@ auto ContainerBuilder::prepareContainer(runtime::RunContext &context,
306307 }
307308
308309 PreparedContainer prepared{
309- .runContext = context,
310+ .runContext = & context,
310311 .context = std::move (*containerContext),
311312 .mode = mode,
312313 };
@@ -323,7 +324,7 @@ auto ContainerBuilder::prepareContainer(runtime::RunContext &context,
323324 auto uid = getuid ();
324325 auto gid = getgid ();
325326
326- prepared.cfgBuilder .setAppId (prepared.runContext . get (). getTargetID ())
327+ prepared.cfgBuilder .setAppId (prepared.runContext -> getTargetID ())
327328 .setBundlePath (prepared.context ->getBundleDir ())
328329 .addUIdMapping (uid, uid, 1 )
329330 .addGIdMapping (gid, gid, 1 )
@@ -353,8 +354,7 @@ auto ContainerBuilder::finalizeContainer(PreparedContainer &prepared) noexcept
353354 bool useOverlayMode = true ;
354355 bool needGenLdConf = false ;
355356 if (prepared.mode == ContainerMode::Init) {
356- auto &runContext = prepared.runContext .get ();
357- const auto &appLayer = runContext.getAppLayer ();
357+ const auto &appLayer = prepared.runContext ->getAppLayer ();
358358 if (!appLayer) {
359359 return LINGLONG_ERR (" app layer not found" );
360360 }
@@ -407,8 +407,7 @@ auto ContainerBuilder::configureBuildContainer(PreparedContainer &prepared,
407407 prepared.cfgBuilder .isolateNetWork ();
408408 }
409409
410- auto &runContext = prepared.runContext .get ();
411- auto res = normalizeContainerRootfs (options.basePath , runContext.getConfig ());
410+ auto res = normalizeContainerRootfs (options.basePath , prepared.runContext ->getConfig ());
412411 if (!res) {
413412 return LINGLONG_ERR (res);
414413 }
@@ -460,7 +459,7 @@ auto ContainerBuilder::configureInitContainer(PreparedContainer &prepared) noexc
460459{
461460 LINGLONG_TRACE (" configure init container" );
462461
463- auto &runContext = prepared.runContext . get () ;
462+ auto &runContext = * prepared.runContext ;
464463
465464 prepared.cfgBuilder .bindXDGRuntime ().bindHostRoot ().bindHostStatics ().forwardDefaultEnv ();
466465
@@ -582,7 +581,7 @@ auto ContainerBuilder::configureRunContainer(PreparedContainer &prepared,
582581 capabilities.insert (capabilities.end (), extraCapabilities.begin (), extraCapabilities.end ());
583582 prepared.cfgBuilder .setCapabilities (std::move (capabilities));
584583
585- auto &runContext = prepared.runContext . get () ;
584+ auto &runContext = * prepared.runContext ;
586585 for (const auto &type : options.getSecurityContexts ()) {
587586 auto manager = getSecurityContextManager (type);
588587 if (!manager) {
0 commit comments