backtrace: Support backtracing even if library is not initialized

But of course backtracing must be initialized anyway using backtrace_init().
This commit is contained in:
Martin Willi
2013-11-06 10:31:00 +01:00
parent a5860cddae
commit 7a13990964
+2 -2
View File
@@ -314,7 +314,7 @@ static void print_sourceline(FILE *file, char *filename, void *ptr, void *base)
bool old = FALSE; bool old = FALSE;
bfd_mutex->lock(bfd_mutex); bfd_mutex->lock(bfd_mutex);
if (lib->leak_detective) if (lib && lib->leak_detective)
{ {
old = lib->leak_detective->set_state(lib->leak_detective, FALSE); old = lib->leak_detective->set_state(lib->leak_detective, FALSE);
} }
@@ -324,7 +324,7 @@ static void print_sourceline(FILE *file, char *filename, void *ptr, void *base)
data.entry = entry; data.entry = entry;
bfd_map_over_sections(entry->abfd, (void*)find_addr, &data); bfd_map_over_sections(entry->abfd, (void*)find_addr, &data);
} }
if (lib->leak_detective) if (lib && lib->leak_detective)
{ {
lib->leak_detective->set_state(lib->leak_detective, old); lib->leak_detective->set_state(lib->leak_detective, old);
} }