From: Jussi Koskela Date: Wed, 22 Nov 2017 12:00:34 +0000 (+0200) Subject: Revert of SCL context using try-finally X-Git-Tag: v1.31.0~26 X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=commitdiff_plain;h=fc6a66f7f4f48ce1a6a7f1281d90efd96d6af834;ds=sidebyside Revert of SCL context using try-finally refs #7634 Change-Id: Icf20bfb365c8965fd1d8af960a0c82e14c45043f --- diff --git a/bundles/org.simantics.document.swt.core/src/org/simantics/document/swt/core/scl/SCL.java b/bundles/org.simantics.document.swt.core/src/org/simantics/document/swt/core/scl/SCL.java index e62d54491..ad5cf7091 100644 --- a/bundles/org.simantics.document.swt.core/src/org/simantics/document/swt/core/scl/SCL.java +++ b/bundles/org.simantics.document.swt.core/src/org/simantics/document/swt/core/scl/SCL.java @@ -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); + } } });