Ignore:
Timestamp:
07/24/07 14:47:27 (5 years ago)
Author:
sys
Message:

memLeaks : ajout de la méthode destroy() pour compenser l'absence d'appel des destructor des XBL si les éléments ont été extraits du Document.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Xul_XedLib/chrome/content/scenarixedlib/core/xedDyn.xbl.xml

    r9199 r9392  
    4343                <implementation> 
    4444                        <field name="fEditor">this</field> 
     45                        <destructor> 
     46                                this.destroyAllHisto(); 
     47                        </destructor> 
    4548                        <method name="initEditorDyn"> 
    4649                                <parameter name="pUrlEditor"/> 
     
    199202                                                vEvent.initEvent(XEDDataChangeEvent, true, false); 
    200203                                                this.fParent.dispatchEvent(vEvent); 
     204                                        } 
     205                                        vHisto.destroy = function(){ 
     206                                                xed.destroyBindings(this.fRemovedNode); 
    201207                                        } 
    202208                                        //Note : il faut dabord ajouter l'histo avant de lancer les events, pour pouvoir ajouter des histo sur cette entrée. 
     
    11131119                                                - function undo() 
    11141120                                                - function redo() 
     1121                                                - Optionnel : function destroy() pour memLeaks. 
    11151122                        --> 
    11161123                        <method name="addHisto"> 
     
    11281135                                                        for(var i = 0; i < 20 && vH!=null; i++) vH = vH._EntryPrevHisto; 
    11291136                                                        this.fHistoCount = i; 
    1130                                                         if(vH) vH._EntryPrevHisto = null; 
     1137                                                        if(vH) { 
     1138                                                                var vH2 = vH._EntryPrevHisto; 
     1139                                                                delete vH._EntryPrevHisto; 
     1140                                                                if(vH2) delete vH2._EntryNextHisto; 
     1141                                                                this.xDestroyHisto(vH2); 
     1142                                                        } 
    11311143                                                } 
    11321144                                        } else { 
     
    11341146                                        } 
    11351147                                        this.fHistoPrev = pObjHisto; 
    1136                                         this.fHistoNext = null; 
     1148                                        if(this.fHistoNext) { 
     1149                                                this.xDestroyHisto(this.fHistoNext); 
     1150                                                this.fHistoNext = null; 
     1151                                        } 
    11371152                                        if(pNewEntry) { 
    11381153                                                var vEvent = document.createEvent("Events"); 
     
    12131228                                ]]></body> 
    12141229                        </method> 
    1215                         <!-- champs internes --> 
     1230                        <!-- champs et methodes internes --> 
     1231                        <method name="destroyAllHisto"> 
     1232                                <body><![CDATA[ 
     1233                                        this.xDestroyHisto(this.fHistoPrev); 
     1234                                        this.xDestroyHisto(this.fHistoNext); 
     1235                                ]]></body> 
     1236                        </method> 
     1237                        <method name="xDestroyHisto"> 
     1238                                <parameter name="pObjHisto"/> 
     1239                                <body><![CDATA[ 
     1240                                        var vH = pObjHisto; 
     1241                                        while(vH) { 
     1242                                                if("destroy" in vH) try {vH.destroy();}catch(e){xed.debug("detroy histo point failed : "+e)} 
     1243                                                vH = vH._PrevHisto || vH._EntryPrevHisto; 
     1244                                        } 
     1245                                        vH = pObjHisto._NextHisto || pObjHisto._EntryNextHisto; 
     1246                                        while(vH) { 
     1247                                                if("destroy" in vH) try {vH.destroy();}catch(e){xed.debug("detroy histo point failed : "+e)} 
     1248                                                vH = vH._NextHisto || vH._EntryNextHisto; 
     1249                                        } 
     1250                                ]]></body> 
     1251                        </method> 
    12161252                        <field name="fHistoPrev"/> 
    12171253                        <field name="fHistoNext"/> 
Note: See TracChangeset for help on using the changeset viewer.