From e7fd4cafbbe0663604f813ffa0e0c329a8a26196 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Fri, 21 Nov 2003 23:32:24 +0000 Subject: [PATCH] Fixed a bug in ChannelDBHandler that *somehow* would cause a wrong database to be returned from getDb. --- src/plugins.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins.py b/src/plugins.py index 3558ad445..8649e7744 100644 --- a/src/plugins.py +++ b/src/plugins.py @@ -116,8 +116,10 @@ class ChannelDBHandler(object): def getDb(self, channel): """Use this to get a database for a specific channel.""" - if channel not in self.dbCache or \ - threading.currentThread() is not world.mainThread: + currentThread = threading.currentThread() + if channel not in self.dbCache and currentThread == world.mainThread: + self.dbCache[channel] = self.makeDb(self.makeFilename(channel)) + if currentThread != world.mainThread: db = self.makeDb(self.makeFilename(channel)) else: db = self.dbCache[channel]