Hi,

First, let me say that log4cxx is great stuff.

Unfortunately, i ran into a nasty issue.

I use the following code fragment in a (very simple sample) MFC application:

    CString string1("logfile.txt");
    LPCTSTR string2 = (LPCTSTR) string1;
    LOG4CXX_DECODE_CHAR(logstring, string2);

This works fine, as long as i link the MFC libraries dynamically.
As soon as i switch over to statically linked, i get a failed assertion in
dbgheap.c (line 1252 i case you're interested ;-)).
It happens when the "logstring" goes out of scope.
The stacktrace shows the assert is triggered during a operator delete.

The source code related to the failed assertion is this:

       /*
         * If this ASSERT fails, a bad pointer has been passed in. It may be
         * totally bogus, or it may have been allocated from another heap.
         * The pointer MUST come from the 'local' heap.
         */
        _ASSERTE(_CrtIsValidHeapPointer(pUserData));

While debugging, the pointer seems to point to a valid structure, so i guess
we've got a problem with allocation from "another heap".

Any ideas?

Switching to dynamically linked MFC libs is not an option for my real
project, as you might have guessed ;-).

Thanks,
Peter.

Reply via email to