*/
public abstract BidirListIterator<G> bidir_list_iterator ();
- private weak BidirList<G> _read_only_view;
+ private WeakRef _read_only_view;
+ construct {
+ _read_only_view = WeakRef(null);
+ }
/**
* {@inheritDoc}
*/
public virtual new BidirList<G> read_only_view {
owned get {
- BidirList<G> instance = _read_only_view;
- if (_read_only_view == null) {
+ BidirList<G>? instance = (BidirList<G>?)_read_only_view.get();
+ if (instance == null) {
instance = new ReadOnlyBidirList<G> (this);
- _read_only_view = instance;
- instance.add_weak_pointer ((void**) (&_read_only_view));
+ _read_only_view.set (instance);
}
return instance;
}
*/
public abstract BidirMapIterator<K,V> bidir_map_iterator ();
- private weak BidirSortedMap<K,V> _read_only_view;
+ private WeakRef _read_only_view;
+ construct {
+ _read_only_view = WeakRef(null);
+ }
/**
* {@inheritDoc}
*/
public virtual new BidirSortedMap<K,V> read_only_view {
owned get {
- BidirSortedMap<K,V> instance = _read_only_view;
- if (_read_only_view == null) {
+ BidirSortedMap<K,V>? instance = (BidirSortedMap<K,V>?)_read_only_view.get ();
+ if (instance == null) {
instance = new ReadOnlyBidirSortedMap<K,V> (this);
- _read_only_view = instance;
- instance.add_weak_pointer ((void**) (&_read_only_view));
+ _read_only_view.set (instance);
}
return instance;
}
*/
public abstract BidirIterator<G> bidir_iterator ();
- private weak BidirSortedSet<G> _read_only_view;
+ private WeakRef _read_only_view;
+ construct {
+ _read_only_view = WeakRef(null);
+ }
/**
* {@inheritDoc}
*/
public virtual new BidirSortedSet<G> read_only_view {
owned get {
- BidirSortedSet<G> instance = _read_only_view;
- if (_read_only_view == null) {
+ BidirSortedSet<G>? instance = (BidirSortedSet<G>?)_read_only_view.get ();
+ if (instance == null) {
instance = new ReadOnlyBidirSortedSet<G> (this);
- _read_only_view = instance;
- instance.add_weak_pointer ((void**) (&_read_only_view));
+ _read_only_view.set (instance);
}
return instance;
}
return iterator ().foreach (f);
}
- private weak Collection<G> _read_only_view;
+ private WeakRef _read_only_view;
+ construct {
+ _read_only_view = WeakRef(null);
+ }
/**
* {@inheritDoc}
*/
public virtual Collection<G> read_only_view {
owned get {
- Collection<G> instance = _read_only_view;
- if (_read_only_view == null) {
+ Collection<G>? instance = (Collection<G>?)_read_only_view.get ();
+ if (instance == null) {
instance = new ReadOnlyCollection<G> (this);
- _read_only_view = instance;
- instance.add_weak_pointer ((void**) (&_read_only_view));
+ _read_only_view.set (instance);
}
return instance;
}
*/
public abstract List<G>? slice (int start, int stop);
- private weak List<G> _read_only_view;
+ private WeakRef _read_only_view;
+ construct {
+ _read_only_view = WeakRef(null);
+ }
/**
* {@inheritDoc}
*/
public virtual new List<G> read_only_view {
owned get {
- List<G> instance = _read_only_view;
- if (_read_only_view == null) {
+ List<G>? instance = (List<G>?)_read_only_view.get ();
+ if (instance == null) {
instance = new ReadOnlyList<G> (this);
- _read_only_view = instance;
- instance.add_weak_pointer ((void**) (&_read_only_view));
+ _read_only_view.set (instance);
}
return instance;
}
*/
public abstract void clear ();
- private weak Map<K,V> _read_only_view;
+ private WeakRef _read_only_view;
+ construct {
+ _read_only_view = WeakRef(null);
+ }
/**
* {@inheritDoc}
*/
public virtual Map<K,V> read_only_view {
owned get {
- Map<K,V> instance = _read_only_view;
- if (_read_only_view == null) {
+ Map<K,V>? instance = (Map<K,V>?)_read_only_view.get ();
+ if (instance == null) {
instance = new ReadOnlyMap<K,V> (this);
- _read_only_view = instance;
- instance.add_weak_pointer ((void**) (&_read_only_view));
+ _read_only_view.set (instance);
}
return instance;
}
public bool mutable { get { return false; } }
}
- private weak MultiMap<K, V> _read_only_view;
+ private WeakRef _read_only_view;
+ construct {
+ _read_only_view = WeakRef(null);
+ }
+
public virtual new MultiMap<K, V> read_only_view {
owned get {
- MultiMap<K, V> instance = _read_only_view;
- if (_read_only_view == null) {
+ MultiMap<K, V>? instance = (MultiMap<K, V>?)_read_only_view.get ();
+ if (instance == null) {
instance = new ReadOnlyMultiMap<K, V> (this);
- _read_only_view = instance;
- instance.add_weak_pointer ((void**) (&_read_only_view));
+ _read_only_view.set (instance);
}
return instance;
}
_nitems = 0;
}
- private weak MultiSet<G> _read_only_view;
+ private WeakRef _read_only_view;
+ construct {
+ _read_only_view = WeakRef(null);
+ }
+
public virtual new MultiSet<G> read_only_view {
owned get {
- MultiSet<G> instance = _read_only_view;
- if (_read_only_view == null) {
+ MultiSet<G>? instance = (MultiSet<G>?)_read_only_view.get ();
+ if (instance == null) {
instance = new ReadOnlyMultiSet<G> (this);
- _read_only_view = instance;
- instance.add_weak_pointer ((void**) (&_read_only_view));
+ _read_only_view.set (instance);
}
return instance;
}
*/
public abstract class Gee.AbstractSet<G> : Gee.AbstractCollection<G>, Set<G> {
- private weak Set<G> _read_only_view;
+ private WeakRef _read_only_view;
+ construct {
+ _read_only_view = WeakRef(null);
+ }
/**
* {@inheritDoc}
*/
public virtual new Set<G> read_only_view {
owned get {
- Set<G> instance = _read_only_view;
- if (_read_only_view == null) {
+ Set<G>? instance = (Set<G>?)_read_only_view.get ();
+ if (instance == null) {
instance = new ReadOnlySet<G> (this);
- _read_only_view = instance;
- instance.add_weak_pointer ((void**) (&_read_only_view));
+ _read_only_view.set (instance);
}
return instance;
}
*/
public abstract SortedSet<Map.Entry<K,V>> ascending_entries { owned get; }
- private weak SortedMap<K,V> _read_only_view;
+ private WeakRef _read_only_view;
+ construct {
+ _read_only_view = WeakRef(null);
+ }
+
/**
* The read-only view this map.
*/
public new SortedMap<K,V> read_only_view {
owned get {
- SortedMap<K,V> instance = _read_only_view;
- if (_read_only_view == null) {
+ SortedMap<K,V>? instance = (SortedMap<K,V>?)_read_only_view.get ();
+ if (instance == null) {
instance = new ReadOnlySortedMap<K,V> (this);
- _read_only_view = instance;
- instance.add_weak_pointer ((void**) (&_read_only_view));
+ _read_only_view.set (instance);
}
return instance;
}
*/
public abstract SortedSet<G> sub_set (G from, G to);
- private weak SortedSet<G> _read_only_view;
+ private WeakRef _read_only_view;
+ construct {
+ _read_only_view = WeakRef(null);
+ }
/**
* {@inheritDoc}
*/
public virtual new SortedSet<G> read_only_view {
owned get {
- SortedSet<G> instance = _read_only_view;
- if (_read_only_view == null) {
+ SortedSet<G>? instance = (SortedSet<G>?)_read_only_view.get ();
+ if (instance == null) {
instance = new ReadOnlySortedSet<G> (this);
- _read_only_view = instance;
- instance.add_weak_pointer ((void**) (&_read_only_view));
+ _read_only_view.set (instance);
}
return instance;
}