[ Home | CW Bug Reports | Mail ]

LModelObject dtrでの早すぎる superModel finalization
Subject: BUG -- premature superModel finalization in LModelObject dtr
 
---------------------------------------------------------------------------
METROWERKS PRODUCT AND USAGE SECTION
 
Product name :            [ CodeWarrior Professional ]
Product version :         [ Pro 4 ]
Component name :          [ PowerPlant ]
Generating:               [ Mac OS 68K / Mac OS PowerPC ]
Purpose:                  [ application ]
 
---------------------------------------------------------------------------
 
BUG DESCRIPTION SECTION
 
Reason for this report:   [ incorrect program feature ]
Bug severity:             [ crashes application ]
Reproducibility:          [ always ]
Problem summary:
 
Finalizing mSuperModel here in the LModelObject::~LModelObject() is a
crucial mistake. If you are getting lazy object's property, you
finalize (delete) upward all lazy superModels prematurely when
destructing a child property.
 
Imagine AEOM hierarchy like this.
  application (not lazy)
       U
  window (element/not lazy)
       U
  matchFile (element/lazy)
       U
  name (property/lazy)
 
The following AppleScript causes a crash. Because the destruction of
name property invokes premature matchFile lazy object deletion. All
matchFile lazy objects are deleted while whose clause resolution, then
get subsequent c++ method call.
 
  tell application "YourApp"
      every matchFile whose name contains "a"
  end tell
 
You must defer the finalization till LModelObject::FinalizeLazies().
 
LModelObject::~LModelObject()
{
    //  :
    //  :
    //  :
 
    if (mSuperModel != nil) {
        mSuperModel->RemoveSubModel(this);
        //  You should not finalize mSuperModel here.
        //  This is a crucial mistake.
////////mSuperModel->Finalize();    //  to delete up chains of lazy objects
   }
}


この Pageは MacOS X + Radio UserLand で作っています。