|
From: Dirk L. <di...@no...> - 2003-02-27 12:39:16
|
Hi, today I had a strange problem with the Categroy::getAllAppenders () function. I'm writing a small gui dialog to customize the logging during the execution of the program. Right now I can edit the categories with the vector returned from getCurrentCategories (). I wanted to display also the list of attached appenders so I asked for the AppenderSet via the function getAllAppenders (). But the returned set is not valid, since the implementation of the _Tree used in the std::set contains a static _Nil node, which is not the same in the process and in the DLL. As a result when I try to iterate the returned set I get an invalid AppenderSet::end () iterator and the iteration continues until the software crashes. Perhaps as little longer description: the STL implementation of the std::set in Microsoft uses a std::_Tree. The std::_Tree maintains one static _Nil and one static _Nilrefs member, that is used to mark the ends in the trees. This _Nil is used in within all _Trees with the same template arguments. Compiling log4cpp as a DLL will result in having one static instance of these to members within the DLL, that are not the same static instances of theses members in the Application. So copying the AppenderSet within the context of the DLL will use the DLLs instance of the _Nil pointer to mark the ends in the _Tree. But iterating through the std::set within the application context will result in the usage of a different _Nil element. So the iteration through the _Tree will never end, since the end of the _Tree will never match the _Nil element. Any ideas how to circumvent the problem? Thanks Dirk |