changeset 164:d91a7e0388da

Preserve bindings for asynchronous drawing.
author Mikhail Kryshen <mikhail@kryshen.net>
date Tue, 25 Nov 2014 17:18:48 +0300
parents dc3ed475c6d6
children 421dba17b7ed
files src/indyvon/async.clj
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/indyvon/async.clj	Mon Nov 24 02:17:54 2014 +0300
+++ b/src/indyvon/async.clj	Tue Nov 25 17:18:48 2014 +0300
@@ -126,13 +126,14 @@
 
 (defn- draw-offscreen-async [async-view]
   (.execute ^ThreadPoolExecutor (:executor async-view)
-            #(draw-offscreen async-view)))
+            (bound-fn* #(draw-offscreen async-view))))
 
 (defrecord AsyncView [scene width height executor buffers]
   View
   (render! [view]
     (repaint-on-update view)
-    (add-context-observer scene (fn [_ _] (draw-offscreen-async view)))
+    (add-context-observer scene (bound-fn [_ _]
+                                  (draw-offscreen-async view)))
     (when-not @buffers
       ;; TODO: dynamic size, recreate buffers when size increases.
       (let [device-conf (.getDeviceConfiguration *graphics*)