From a8b7b2cdbd9cbbab204cc72aa4f1ff7cb0a200f9 Mon Sep 17 00:00:00 2001 From: chrox Date: Fri, 16 May 2014 13:58:00 +0800 Subject: [PATCH] add base document init method to create new configurable for each document this should fix configurables pollution when opening multiple documents at the same time, e.g. when clipping page images in Evernote plugin. --- frontend/document/document.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/document/document.lua b/frontend/document/document.lua index 7001dd32c..261743098 100644 --- a/frontend/document/document.lua +++ b/frontend/document/document.lua @@ -50,18 +50,22 @@ local Document = { -- flag to show that the document needs to be unlocked by a password is_locked = false, - - configurable = Configurable, } function Document:new(o) local o = o or {} setmetatable(o, self) self.__index = self + if o._init then o:_init() end if o.init then o:init() end return o end +-- base document initialization should be called on each document init +function Document:_init() + self.configurable = Configurable:new() +end + -- override this method to open a document function Document:init() end