]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.document.swt.core/src/org/simantics/document/swt/core/scl/SCL.java
Revert of SCL context using try-finally
[simantics/platform.git] / 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);
+                                               }
                                        }
                                        
                                });