<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to 79: Read access violation at program exit</title><link>https://sourceforge.net/p/log4cpp/bugs/79/</link><description>Recent changes to 79: Read access violation at program exit</description><atom:link href="https://sourceforge.net/p/log4cpp/bugs/79/feed.rss" rel="self"/><language>en</language><lastBuildDate>Mon, 22 Nov 2004 09:27:45 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/log4cpp/bugs/79/feed.rss" rel="self" type="application/rss+xml"/><item><title>Read access violation at program exit</title><link>https://sourceforge.net/p/log4cpp/bugs/79/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;There is an order of call Category::getInstance and &lt;br /&gt;
Appender::ctor so program will be terminated at exit.&lt;/p&gt;
&lt;p&gt;More precisely if I call Category::getInstance first (in &lt;br /&gt;
order to create own category), further I create new &lt;br /&gt;
appender (by new operator) the following internal &lt;br /&gt;
functions will be called in specified order:&lt;/p&gt;
&lt;p&gt;1. // Due to Category::getInstance&lt;br /&gt;
HierarchyMaintainer&amp;amp; &lt;br /&gt;
HierarchyMaintainer::getDefaultMaintainer() {&lt;br /&gt;
static HierarchyMaintainer _defaultMaintainer;&lt;/p&gt;
&lt;p&gt;return _defaultMaintainer;&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;2. // Due to Appender::ctor&lt;br /&gt;
Appender::AppenderMap&amp;amp; Appender::_getAllAppenders&lt;br /&gt;
() {&lt;br /&gt;
static Appender::AppenderMap _allAppenders;&lt;/p&gt;
&lt;p&gt;return _allAppenders;&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;Thus destructor for _allAppenders will be called before &lt;br /&gt;
dtor for defaultMaintainer.&lt;/p&gt;
&lt;p&gt;As I have seen, &lt;br /&gt;
HierarchyMaintainer::~HierarchyMaintainer &lt;br /&gt;
calls ::_getAllAppenders through shutdown() / &lt;br /&gt;
Category::removeAllAppenders, so _getAllAppenders &lt;br /&gt;
refers to destroyed _allAppenders.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Anonymous</dc:creator><pubDate>Mon, 22 Nov 2004 09:27:45 -0000</pubDate><guid>https://sourceforge.net47a81bf3b458936d72e5d3694318cdec4e6aa496</guid></item></channel></rss>