summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej Piechotka <uzytkownik2@gmail.com>2013-07-12 20:46:06 +0200
committerMaciej Piechotka <uzytkownik2@gmail.com>2013-07-14 23:24:43 +0200
commitbd7598ae5653301235dfe0a990f5064cfb563cc2 (patch)
tree12b063e0085a0741d3923457c1028bf5345ad6db
parent3410f06a5390a8df77d324a5e5f010e91ce3ed1e (diff)
downloadlibgee-bd7598ae5653301235dfe0a990f5064cfb563cc2.tar.gz
Change the scope="async" callbacks to owned, fixes bug #703802
-rw-r--r--gee/flatmapfuture.vala6
-rw-r--r--gee/future.vala18
-rw-r--r--gee/lightmapfuture.vala2
-rw-r--r--gee/mapfuture.vala8
-rw-r--r--gee/promise.vala2
-rw-r--r--gee/zipfuture.vala6
6 files changed, 21 insertions, 21 deletions
diff --git a/gee/flatmapfuture.vala b/gee/flatmapfuture.vala
index 76e95ae..eafb146 100644
--- a/gee/flatmapfuture.vala
+++ b/gee/flatmapfuture.vala
@@ -21,9 +21,9 @@
*/
internal class Gee.FlatMapFuture<A, G> : Object, Future<A> {
- public FlatMapFuture (Future<G> base_future, Future.FlatMapFunc<A, G> func) {
+ public FlatMapFuture (Future<G> base_future, owned Future.FlatMapFunc<A, G> func) {
_base = base_future;
- _func = func;
+ _func = (owned)func;
_base.when_done ((val) => {
_mutex.lock ();
if (_progress == Progress.INIT) {
@@ -114,7 +114,7 @@ internal class Gee.FlatMapFuture<A, G> : Object, Future<A> {
assert_not_reached ();
}
- public void when_done (Future.WhenDoneFunc<A> func) {
+ public void when_done (owned Future.WhenDoneFunc<A> func) {
_mutex.lock ();
if (_progress == Progress.READY) {
_mutex.unlock ();
diff --git a/gee/future.vala b/gee/future.vala
index e73863e..7b8cc5a 100644
--- a/gee/future.vala
+++ b/gee/future.vala
@@ -122,7 +122,7 @@ public interface Gee.Future<G> : Object {
* future it is recommended to not include lengthly computation.
* If one is needed please use {@link task}.
*/
- public abstract void when_done (WhenDoneFunc<G> func);
+ public abstract void when_done (owned WhenDoneFunc<G> func);
public delegate A MapFunc<A, G> (G value);
@@ -141,8 +141,8 @@ public interface Gee.Future<G> : Object {
* value eagerly by {@link when_done} it is recommended to use
* {@link task} and {@link flat_map} for longer computation.
*/
- public virtual Future<A> map<A> (MapFunc<A, G> func) {
- return new MapFuture<A, G> (this, func);
+ public virtual Future<A> map<A> (owned MapFunc<A, G> func) {
+ return new MapFuture<A, G> (this, (owned)func);
}
public delegate unowned A LightMapFunc<A, G> (G value);
@@ -189,8 +189,8 @@ public interface Gee.Future<G> : Object {
* value eagerly by {@link when_done} it is recommended to return a
* future from {@link task} and use {@link flat_map} for longer computation.
*/
- public virtual Future<B> zip<A, B> (ZipFunc<G, A, B> zip_func, Future<A> second) {
- return new ZipFuture<G, A, B> (zip_func, this, second);
+ public virtual Future<B> zip<A, B> (owned ZipFunc<G, A, B> zip_func, Future<A> second) {
+ return new ZipFuture<G, A, B> ((owned)zip_func, this, second);
}
[CCode (scope = "async")]
@@ -210,13 +210,13 @@ public interface Gee.Future<G> : Object {
* larger computation inside the returned future for example by
* {@link task}
*/
- public virtual Gee.Future<A> flat_map<A>(FlatMapFunc<A, G> func) {
- return new FlatMapFuture<A, G> (this, func);
+ public virtual Gee.Future<A> flat_map<A>(owned FlatMapFunc<A, G> func) {
+ return new FlatMapFuture<A, G> (this, (owned)func);
}
internal struct WhenDoneArrayElement<G> {
- public WhenDoneArrayElement (WhenDoneFunc<G> func) {
- this.func = func;
+ public WhenDoneArrayElement (owned WhenDoneFunc<G> func) {
+ this.func = (owned)func;
}
public WhenDoneFunc<G> func;
}
diff --git a/gee/lightmapfuture.vala b/gee/lightmapfuture.vala
index 8b51821..bc8e995 100644
--- a/gee/lightmapfuture.vala
+++ b/gee/lightmapfuture.vala
@@ -50,7 +50,7 @@ internal class Gee.LightMapFuture<A, G> : Object, Future<A> {
return _func (arg);
}
- public void when_done (Future.WhenDoneFunc<G> func) {
+ public void when_done (owned Future.WhenDoneFunc<G> func) {
_base.when_done ((a) => {_func (a);});
}
diff --git a/gee/mapfuture.vala b/gee/mapfuture.vala
index 3d3bb8d..b2117d6 100644
--- a/gee/mapfuture.vala
+++ b/gee/mapfuture.vala
@@ -21,9 +21,9 @@
*/
internal class Gee.MapFuture<A, G> : Object, Future<A> {
- public MapFuture (Future<G> future_base, Future.MapFunc<A, G> func) {
+ public MapFuture (Future<G> future_base, owned Future.MapFunc<A, G> func) {
_base = future_base;
- _func = func;
+ _func = (owned)func;
_base.when_done ((val) => {
_mutex.lock ();
if (_progress == Progress.INIT) {
@@ -117,13 +117,13 @@ internal class Gee.MapFuture<A, G> : Object, Future<A> {
assert_not_reached ();
}
- public void when_done (Future.WhenDoneFunc<A> func) {
+ public void when_done (owned Future.WhenDoneFunc<A> func) {
_mutex.lock ();
if (_progress == Progress.READY) {
_mutex.unlock ();
func (_value);
} else {
- _when_done += Future.WhenDoneArrayElement<G>(func);
+ _when_done += Future.WhenDoneArrayElement<G>((owned)func);
_mutex.unlock ();
}
}
diff --git a/gee/promise.vala b/gee/promise.vala
index 61e5754..45f46ce 100644
--- a/gee/promise.vala
+++ b/gee/promise.vala
@@ -88,7 +88,7 @@ public class Gee.Promise<G> {
return result;
}
- public void when_done (Gee.Future.WhenDoneFunc<G> func) {
+ public void when_done (owned Gee.Future.WhenDoneFunc<G> func) {
_mutex.lock ();
if (_ready) {
_mutex.unlock ();
diff --git a/gee/zipfuture.vala b/gee/zipfuture.vala
index 514e776..33be449 100644
--- a/gee/zipfuture.vala
+++ b/gee/zipfuture.vala
@@ -21,10 +21,10 @@
*/
internal class Gee.ZipFuture<A, B, C> : GLib.Object, Gee.Future<C> {
- public ZipFuture (Future.ZipFunc<A, B, C> func, Future<A> left, Future<B> right) {
+ public ZipFuture (owned Future.ZipFunc<A, B, C> func, Future<A> left, Future<B> right) {
_left = left;
_right = right;
- _func = func;
+ _func = (owned)func;
_left.when_done ((l) => {
_right.when_done ((r) => {
_mutex.lock ();
@@ -128,7 +128,7 @@ internal class Gee.ZipFuture<A, B, C> : GLib.Object, Gee.Future<C> {
assert_not_reached ();
}
- public void when_done (Future.WhenDoneFunc<C> func) {
+ public void when_done (owned Future.WhenDoneFunc<C> func) {
_mutex.lock ();
if (_progress == Progress.READY) {
_mutex.unlock ();