From 96b1c08804ccc7213445a967a76a3b49d7f205a0 Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Tue, 26 Aug 2014 00:43:44 +0200 Subject: [PATCH] doubleclick: sanity check re multiple contexts --- vdirsyncer/doubleclick.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/vdirsyncer/doubleclick.py b/vdirsyncer/doubleclick.py index 0529981..5597a62 100644 --- a/vdirsyncer/doubleclick.py +++ b/vdirsyncer/doubleclick.py @@ -100,7 +100,15 @@ def _ctx_pushing_class(cls): try: cls.invoke(self, ctx) finally: - _ctx_stack.pop() + new_ctx = _ctx_stack.pop() + if new_ctx is not ctx: + raise RuntimeError( + 'While doubleclick is supposed to make writing ' + 'threaded applications easier, it removes thread ' + 'safety from click. It is therefore not recommended ' + 'to launch more than one doubleclick application per ' + 'process.' + ) return ContextPusher