* Tear down FM instances properly
* Don't manhandle ReaderUI too much, and document when the tests do
actively broken shit, like bypassing safeties to open two // ReaderUI
instances.
logger.dbg("Spinning up new FileManager instance",tostring(self))
logger.dbg("Spinning up new FileManager instance",tostring(self))
else
else
-- Should never happen, given what we did above...
-- Should never happen, given what we did in showFiles...
logger.err("FileManager instance mismatch! Opened",tostring(self),"while we still have an existing instance:",tostring(FileManager.instance),debug.traceback())
logger.err("FileManager instance mismatch! Opened",tostring(self),"while we still have an existing instance:",tostring(FileManager.instance),debug.traceback())
end
end
FileManager.instance=self
FileManager.instance=self
@ -1159,6 +1159,7 @@ function FileManager:getStartWithMenuTable()
}
}
end
end
--- @note: This is the *only* safe way to instantiate a new FileManager instance!
functionFileManager:showFiles(path,focused_file)
functionFileManager:showFiles(path,focused_file)
-- Warn about and close any pre-existing FM instances first...
-- Warn about and close any pre-existing FM instances first...
logger.dbg("Spinning up new ReaderUI instance",tostring(self))
logger.dbg("Spinning up new ReaderUI instance",tostring(self))
else
else
-- Should never happen, given what we did above...
-- Should never happen, given what we did in (do)showReader...
logger.err("ReaderUI instance mismatch! Opened",tostring(self),"while we still have an existing instance:",tostring(ReaderUI.instance),debug.traceback())
logger.err("ReaderUI instance mismatch! Opened",tostring(self),"while we still have an existing instance:",tostring(ReaderUI.instance),debug.traceback())
end
end
ReaderUI.instance=self
ReaderUI.instance=self
@ -504,6 +504,8 @@ function ReaderUI:onSetupShowReader()
end
end
--- @note: Will sanely close existing FileManager/ReaderUI instance for you!
--- @note: Will sanely close existing FileManager/ReaderUI instance for you!
--- This is the *only* safe way to instantiate a new ReaderUI instance!
--- (i.e., don't look at the testsuite, which resorts to all kinds of nasty hacks).