]> git.cworth.org Git - sup/commitdiff
bugfix: wrap thread loading in a mutex to avoid all sorts of crazy problems
authorwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Wed, 13 Jun 2007 01:44:26 +0000 (01:44 +0000)
committerwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Wed, 13 Jun 2007 01:44:26 +0000 (01:44 +0000)
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@456 5c8cc53c-5e98-4d25-b20a-d8db53a31250

lib/sup/buffer.rb
lib/sup/modes/thread-index-mode.rb

index 553716911abd9a1f1116c0478e1bac6b62444c36..bb94fbe60ea87107c036c07732b8faf455af5a57 100644 (file)
@@ -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
index 70af73c4897303e66f7da2315d619d90b2255769..33e2062e1ca9cceb98fa6e314fb602f8dc6fbad2 100644 (file)
@@ -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