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.
pull/581/head
chrox 10 years ago
parent 295d0406a2
commit a8b7b2cdbd

@ -50,18 +50,22 @@ local Document = {
-- flag to show that the document needs to be unlocked by a password -- flag to show that the document needs to be unlocked by a password
is_locked = false, is_locked = false,
configurable = Configurable,
} }
function Document:new(o) function Document:new(o)
local o = o or {} local o = o or {}
setmetatable(o, self) setmetatable(o, self)
self.__index = self self.__index = self
if o._init then o:_init() end
if o.init then o:init() end if o.init then o:init() end
return o return o
end 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 -- override this method to open a document
function Document:init() function Document:init()
end end

Loading…
Cancel
Save