Make the assembler generate an error if there is an attempt to define a section with...
[deliverable/binutils-gdb.git] / gdb / objfiles.c
index 56854cc5c63bdf92de7263faad8f492970119134..ff408b605277c14c9fe105f72166228333731694 100644 (file)
@@ -1,6 +1,6 @@
 /* GDB routines for manipulating objfiles.
 
-   Copyright (C) 1992-2019 Free Software Foundation, Inc.
+   Copyright (C) 1992-2020 Free Software Foundation, Inc.
 
    Contributed by Cygnus Support, using pieces from other GDB modules.
 
@@ -486,7 +486,10 @@ objfile::make (bfd *bfd_, const char *name_, objfile_flags flags_,
   if (parent != nullptr)
     add_separate_debug_objfile (result, parent);
 
-  current_program_space->add_objfile (result, parent);
+  /* Using std::make_shared might be a bit nicer here, but that would
+     require making the constructor public.  */
+  current_program_space->add_objfile (std::shared_ptr<objfile> (result),
+                                     parent);
 
   /* Rebuild section map next time we need it.  */
   get_objfile_pspace_data (current_program_space)->new_objfiles_available = 1;
@@ -500,7 +503,6 @@ void
 objfile::unlink ()
 {
   current_program_space->remove_objfile (this);
-  delete this;
 }
 
 /* Free all separate debug objfile of OBJFILE, but don't free OBJFILE
This page took 0.024506 seconds and 4 git commands to generate.