diff --git a/src/main/scala/leon/synthesis/SimpleSearch.scala b/src/main/scala/leon/synthesis/SimpleSearch.scala
index 88a51b8059d4e0508bfe4f50aa71235ead18b8c8..d3ddd51539a277703c6610a13e560b83c4fe56c6 100644
--- a/src/main/scala/leon/synthesis/SimpleSearch.scala
+++ b/src/main/scala/leon/synthesis/SimpleSearch.scala
@@ -68,8 +68,12 @@ class SimpleSearch(synth: Synthesizer,
     }
   }
 
+  var shouldStop = false
+
   def search(): Option[Solution] = {
-    while (!g.tree.isSolved) {
+    shouldStop = false
+
+    while (!g.tree.isSolved && !shouldStop) {
       nextLeaf() match {
         case Some(l)  =>
           l match {
@@ -86,4 +90,10 @@ class SimpleSearch(synth: Synthesizer,
     }
     g.tree.solution
   }
+
+  override def stop() {
+    super.stop()
+    shouldStop = true
+    sctx.solver.halt()
+  }
 }