]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Revert of SCL context using try-finally 51/1251/2
authorJussi Koskela <jussi.koskela@semantum.fi>
Wed, 22 Nov 2017 12:00:34 +0000 (14:00 +0200)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Wed, 22 Nov 2017 12:33:39 +0000 (15:33 +0300)
refs #7634

Change-Id: Icf20bfb365c8965fd1d8af960a0c82e14c45043f

bundles/org.simantics.document.swt.core/src/org/simantics/document/swt/core/scl/SCL.java

index e62d544911ab54b74b2b65398e6eeabae9948df4..ad5cf709169a75f392e0d12165b416949e3501bb 100644 (file)
@@ -42,9 +42,12 @@ public class SCL {
                                            SCLContext sclContext = SCLContext.getCurrent();
                                            Object oldPrinter = sclContext.put(SCLReportingHandler.REPORTING_HANDLER, printer);
                                                Object oldGraph = sclContext.put("graph", graph);
-                                               fn.apply(Tuple0.INSTANCE);
-                                               sclContext.put(SCLReportingHandler.REPORTING_HANDLER, oldPrinter);
-                                               sclContext.put("graph", oldGraph);
+                                               try {
+                                                       fn.apply(Tuple0.INSTANCE);
+                                               } finally {
+                                                       sclContext.put(SCLReportingHandler.REPORTING_HANDLER, oldPrinter);
+                                                       sclContext.put("graph", oldGraph);
+                                               }
                                        }
                                        
                                });