Skip to content

Commit 93466dd

Browse files
authored
Fix Dangling Ref in EB Init (#5635)
Follow-up to #5209: My compiler says those locations would reference temporary objects that were destroyed at the end of the line. That seems to be the case indeed. Copy instead to make the temporary a named and thus persistent variable. ![Screenshot from 2025-02-03 16-59-22](https://github.com/user-attachments/assets/8259f6d7-099b-4d09-8382-f24baefb5793)
1 parent 57f6317 commit 93466dd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Source/EmbeddedBoundary/WarpXInitEB.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ WarpX::MarkReducedShapeCells (
147147
amrex::Array4<int> const & eb_reduce_particle_shape_arr = eb_reduce_particle_shape->array(mfi);
148148

149149
// Check if the box (including one layer of guard cells) contains a mix of covered and regular cells
150-
const amrex::Box& eb_info_box = mfi.tilebox(amrex::IntVect::TheCellVector()).grow(1);
150+
const amrex::Box eb_info_box = mfi.tilebox(amrex::IntVect::TheCellVector()).grow(1);
151151
amrex::FabType const fab_type = eb_flag[mfi].getType( eb_info_box );
152152

153153
if (fab_type == amrex::FabType::regular) { // All cells in the box are regular
@@ -240,7 +240,7 @@ WarpX::MarkUpdateCellsStairCase (
240240
amrex::Array4<int> const & eb_update_arr = eb_update[idim]->array(mfi);
241241

242242
// Check if the box (including one layer of guard cells) contains a mix of covered and regular cells
243-
const amrex::Box& eb_info_box = mfi.tilebox(amrex::IntVect::TheCellVector()).grow(1);
243+
const amrex::Box eb_info_box = mfi.tilebox(amrex::IntVect::TheCellVector()).grow(1);
244244
amrex::FabType const fab_type = eb_flag[mfi].getType( eb_info_box );
245245

246246
if (fab_type == amrex::FabType::regular) { // All cells in the box are regular

0 commit comments

Comments
 (0)