Celto,

Is this a stopgap or an actual fix? I'm less familiar with the code there,
it's more of Ben's work (and we are about to move to Boost Threads -- still
waiting for the person to take this up to completion) so I'd rather not
touch it for now unless there is a proven test case to make it crash and
then this fix indeed resolves the issue without breaking anything else.

BTW, as _internal is always created using new (as opposed to _CLNEW)
internally, you would rather use delete _internal; than the _CLDELETE macro.
You can also nullify it yourself, but there's no point in nullifying member
variables in the destructor unless they are shared.

Itamar.

-----Original Message-----
From: cel tix44 [mailto:celti...@gmail.com] 
Sent: Wednesday, November 11, 2009 1:04 AM
To: clucene-developers@lists.sourceforge.net
Subject: [CLucene-dev] Branch 2.3.2 -- crash in ThreadLocal.cpp

Team

I hit a crash while testing a DLL compiled from the GIT branch marked "ASCII
+ misc fixes". I used CMake 2.6.4 to generate code for VS 2008 with
ENABLE_ASCII_MODE | DISABLE_MULTITHREADING.

It appears that (under certain circumstances) DLLMain implemented in
ThreadLocal.cpp gets invoked with fdwReason=3 (DLL_THREAD_DETACH) more than
once. As my test is compiled with DISABLE_MULTITHREADING,
UnregisterCurrentThread() attempts to unregister the same (current) thread
more than once, which causes Access Violation with NULL pointers or pointers
to 0xFEEEFEEE (freed memory).

As a stopgap, I used the fix below.

Regards
Celto

-------------------------
1) in _ThreadLocal::~_ThreadLocal():
replace this line:
           delete _internal;
with:
        _CLDELETE(_internal);
        _CLDELETE(threadData);

2) in _ThreadLocal::setNull()
add this check:
                if (_internal == NULL ){
                        return;
                }

----------------------------------------------------------------------------
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus
on what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
CLucene-developers mailing list
CLucene-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/clucene-developers



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
CLucene-developers mailing list
CLucene-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/clucene-developers

Reply via email to