Hi,
since the current persistency models do not work (at least for me), I
have created my own which saves the image on each modification:
PRPersistency suclass: #PRSaveImagePersistency
...
PRSaveImagePersistency>>snapshot
[SmalltalkImage current snapshot: true andQuit: false]
forkAt: Processor userBackgroundPriority
PRSaveImagePersistency>>log: aContext
self snapshot
PRSaveImagePersistency>>do: aBlock
try this for do: and reverseDo:
do: aBlock
contexts do: [:each |
aBlock value: (each setKernel: self kernel; yourself)]
reverseDo: aBlock
contexts reverseDo: [:each |
aBlock value: (each setKernel: self kernel; yourself)]
and you'll at least get history working. The code in the
PRImagePersistency is wrong and doesn't work, this code will. I checked
in these changes once but Lucas never merged them so they were lost
leaving the PRImagePersistency non functional.
I tried digging into this once myself and fixing PRFilePersistency, but
ran into problems I couldn't get around, here's the relevant info if you
want to take a crack at it.
PRFilePersistency>>do: aBlock
"There's a bug in deserialization that leaves commands with no fields
or context, this causes an error which despite the ensure below, leaves
the filestream open preventing any further use of that file, at which
point fileNamed returns nil for all future calls. I'm returning self to
prevent an error, the gc does eventually close the file and things start
working again. I think the bug is actually in the MABinaryWriter when
it serializes the command"
| fileStream |
fileStream := self directory fileNamed: self logFilename.
fileStream ifNil: [^self].
[[fileStream atEnd] whileFalse:
[aBlock value: ((MABinaryReader read: fileStream)
setKernel: self kernel;
yourself)]]
ensure: [fileStream close]
and...
PREditCommand>>write: anObject using: aDescription
"this guard clause prevents this command from blowing up the
deserialization of commands in PRFilePersistency, which is currently
buggy for some reason, will remove once I chase down the error. - rjl"
context ifNil:[^self].
^ (self description includes: aDescription)
ifFalse: [ super write: anObject using: aDescription ]
ifTrue: [ self fields at: aDescription put: anObject ]
Currently the lack of persistence is a serious show stopper with Pier,
hopefully Lucas, or someone with the necessary know how can find some
time in the near future to fix this.