Issue 79025 - derefence of pType after typelib_typedescription_release if it
Summary: derefence of pType after typelib_typedescription_release if it
Alias: None
Product: udk
Classification: Code
Component: code (show other issues)
Version: OOo 2.2.1
Hardware: All All
: P3 Trivial (vote)
Target Milestone: AOO PleaseHelp
Assignee: AOO issues mailing list
QA Contact:
Depends on:
Reported: 2007-06-29 15:16 UTC by caolanm
Modified: 2017-05-20 11:31 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Note You need to log in before you can comment on or make changes to this issue.
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 "".