WeakArray new error
By Luca Bruno - Posted on August 16th, 2008
Tagged: 3.0.3
| Project: | GNU Smalltalk |
| Component: | Base classes |
| Category: | bug |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | fixed |
Description
Hello,
I've been trying to use WeakArrays. This is the error when I issue WeakArray new:
Object: nil error: did not understand #do:
MessageNotUnderstood(Exception)>>signal
UndefinedObject(Object)>>doesNotUnderstand: #do:
WeakArray>>do:
WeakArray(Array)>>printOn:
WeakArray(Object)>>printString
WeakArray(Object)>>printNl
Doesn't happen with WeakArray new: size.
Updates
#1 submitted by Paolo Bonzini on Sun, 08/17/2008 - 08:09
| Status: | active | » fixed |
Fixed in c6b3fdf, thanks!
diff --git a/kernel/WeakObjects.st b/kernel/WeakObjects.st
index 8b4127f..60fd905 100644
--- a/kernel/WeakObjects.st
+++ b/kernel/WeakObjects.st
@@ -39,9 +39,15 @@ Array subclass: WeakArray [
I am similar to a plain array, but my items are stored in a weak object,
so I track which of them are garbage collected.'>
+ WeakArray class >> new [
+ "Create a new WeakArray of size 0."
+
+
+ ^self new: 0
+ ]
+
WeakArray class >> new: size [
- "Private - Initialize the values array; plus, make it weak and create
- the ByteArray used to track garbage collected values"
+ "Create a new WeakArray of the given size."
^self basicNew initialize: size
