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?a=commitdiff_plain;h=refs%2Fchanges%2F51%2F1251%2F2;p=simantics%2Fplatform.git 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); + } } });