Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0007622 [Squeak] Morphic minor always 04-19-11 17:15 05-15-11 22:35
Reporter garydunnhi View Status public  
Assigned To
Priority normal Resolution open Platform
Status new   OS
Projection none   OS Version
ETA none Fixed in Version Product Version 4.2
  Product Build
Summary 0007622: Book morph save as new-page prototype fails
Description setNewPagePrototype
    "Record the current page as the prototype to be copied when inserting new pages."

    currentPage ifNotNil:
        [newPagePrototype := currentPage veryDeepCopy].


veryDeepCopyWith: deepCopier
    "Copy me and the entire tree of objects I point to. An object in the tree twice is copied once, and both references point to him. deepCopier holds a dictionary of objects we have seen. Some classes refuse to be copied. Some classes are picky about which fields get deep copied."
    | class index sub subAss new uc sup has mine |
    deepCopier references at: self ifPresent: [:newer | ^ newer]. "already did him"
    class := self class.
    class isMeta ifTrue: [^ self]. "a class"
    new := self clone.
    (class isSystemDefined not and: [deepCopier newUniClasses "allowed"]) ifTrue: [
        uc := deepCopier uniClasses at: class ifAbsent: [nil].
        uc ifNil: [
            deepCopier uniClasses at: class put: (uc := self copyUniClassWith: deepCopier).

                                                                                               ^^^^^^^^^^^^^^^^^^^

            deepCopier references at: class put: uc]. "remember"
        new := uc new.
        new copyFrom: self]. "copy inst vars in case any are weak"
    deepCopier references at: self put: new. "remember"
    (class isVariable and: [class isPointers]) ifTrue:
        [index := self basicSize.
        [index > 0] whileTrue:
            [sub := self basicAt: index.
            (subAss := deepCopier references associationAt: sub ifAbsent: [nil])
                ifNil: [new basicAt: index put: (sub veryDeepCopyWith: deepCopier)]
                ifNotNil: [new basicAt: index put: subAss value].
            index := index - 1]].
    "Ask each superclass if it wants to share (weak copy) any inst vars"
    new veryDeepInner: deepCopier. "does super a lot"

    "other superclasses want all inst vars deep copied"
    sup := class. index := class instSize.
    [has := sup compiledMethodAt: #veryDeepInner: ifAbsent: [nil].
    has := has ifNil: [class isSystemDefined not "is a uniClass"] ifNotNil: [true].
    mine := sup instVarNames.
    has ifTrue: [index := index - mine size] "skip inst vars"
        ifFalse: [1 to: mine size do: [:xx |
                sub := self instVarAt: index.
                (subAss := deepCopier references associationAt: sub ifAbsent: [nil])
                        "use association, not value, so nil is an exceptional value"
                    ifNil: [new instVarAt: index put:
                                (sub veryDeepCopyWith: deepCopier)]
                    ifNotNil: [new instVarAt: index put: subAss value].
                index := index - 1]].
    (sup := sup superclass) == nil] whileFalse.
    new rehash. "force Sets and Dictionaries to rehash"
    ^ new
Steps To Reproduce
Additional Information
Attached Files

- Relationships

- Notes
(0014100 - 117 - 117 - 117 - 117 - 117 - 117)
garydunnhi
05-15-11 22:35

Please close. This was caused by failure to create master page correctly. A nicer error messege would be appreciated.
 

- Issue History
Date Modified Username Field Change
04-19-11 17:15 garydunnhi New Issue
05-15-11 22:35 garydunnhi Note Added: 0014100


Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
31 total queries executed.
26 unique queries executed.
Powered by Mantis Bugtracker