From 1a95fd7f007d9a4214582c70123f9e7ea6a4e1f3 Mon Sep 17 00:00:00 2001 From: wmorgan Date: Wed, 13 Jun 2007 01:44:26 +0000 Subject: [PATCH] bugfix: wrap thread loading in a mutex to avoid all sorts of crazy problems git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@456 5c8cc53c-5e98-4d25-b20a-d8db53a31250 --- lib/sup/buffer.rb | 1 - lib/sup/modes/thread-index-mode.rb | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb index 5537169..bb94fbe 100644 --- a/lib/sup/buffer.rb +++ b/lib/sup/buffer.rb @@ -444,7 +444,6 @@ class BufferManager ## a little tricky because we can't just delete_at id because ids ## are relative (they're positions into the array). def clear id - return unless id # not sure why this happens---thread stuff? @minibuf_mutex.synchronize do @minibuf_stack[id] = nil if id == @minibuf_stack.length - 1 diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb index 70af73c..33e2062 100644 --- a/lib/sup/modes/thread-index-mode.rb +++ b/lib/sup/modes/thread-index-mode.rb @@ -29,13 +29,13 @@ class ThreadIndexMode < LineCursorMode def initialize hidden_labels=[], load_thread_opts={} super() + @mutex = Mutex.new @load_thread = nil @load_thread_opts = load_thread_opts @hidden_labels = hidden_labels + LabelManager::HIDDEN_LABELS @date_width = DATE_WIDTH @from_width = FROM_WIDTH @size_width = nil - @last_load_more_size = nil @tags = Tagger.new self @@ -44,6 +44,7 @@ class ThreadIndexMode < LineCursorMode UpdateManager.register self + @last_load_more_size = nil to_load_more do |size| next if @last_load_more_size == 0 load_threads :num => 1, :background => false @@ -366,6 +367,7 @@ class ThreadIndexMode < LineCursorMode BufferManager.draw_screen @ts.size - orig_size end + synchronized :load_n_threads def status if (l = lines) == 0 -- 2.45.2