Issue 79025

Summary: derefence of pType after typelib_typedescription_release if it
Product: udk Reporter: caolanm
Component: codeAssignee: AOO issues mailing list <issues>
Status: ACCEPTED --- QA Contact:
Severity: Trivial    
Priority: P3 CC: issues
Version: OOo 2.2.1   
Target Milestone: AOO PleaseHelp   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---

Description caolanm 2007-06-29 15:16:39 UTC
in cppu/source/typelib/typelib.cxx "typelib_typedescription_register"

we have this code...

if( pTDR->pType->bOnDemand && !(*ppNewDescription)->bOnDemand ){
        // switch from OnDemand to !OnDemand, so the description must be acquire
        typelib_typedescription_acquire( pTDR->pType );}
else if( !pTDR->pType->bOnDemand && (*ppNewDescription)->bOnDemand ){
        // switch from !OnDemand to OnDemand, so the description must be relesed
        typelib_typedescription_release( pTDR->pType );}

pTDR->pType->bOnDemand = (*ppNewDescription)->bOnDemand; // initialized
pTDR->pType->pWeakRef = pTDR;

Surely if we *do* call typelib_typedescription_release on pType then we should't
go on to deference it afterwards ?
Comment 1 kay.ramme 2007-07-06 14:50:06 UTC
->Stephan, can you help with this? On a first look, Caolans comment seems to be
valid ...
Comment 2 Stephan Bergmann 2007-07-09 09:21:45 UTC
@cmc:  Have you seen this code fail, or is it just a potential problem?

Anyway, should be easy to correct.
Comment 3 caolanm 2007-07-09 09:24:36 UTC
no, just potential.
Comment 4 Stephan Bergmann 2007-10-02 13:05:59 UTC
This is really awkward code.  Talked about it with dbo, we both think it is best
to leave it alone for the moment (reluctant to move the modification of
pTDR->pType before typelib_typedescription_release, in case
typelib_typedescription_release depends on the old state of pTDR->pType).  "If
it ain't fixed, don't break it."  :(
Comment 5 Marcus 2017-05-20 11:31:36 UTC
Reset assigne to the default "".