Project

General

Profile

致命的 #579

抽出タブの作成/削除の際にmikutterがクラッシュする

Added by Takuma Nakajima over 6 years ago. Updated over 6 years ago.

Status:
終了
Priority:
通常
Target version:
Start date:
2013-03-28
Due date:
% Done:

0%

プラグイン名:

Description

抽出タブを作成する際にmikutterがクラッシュする.
Ruby: 2.0.0p0
RubyGnome2: 1.2.3
出力されるエラーは以下の通り.

error: {MIKUTTER_DIR}/core/mui/gtk_extension.rb:45:in `rescue in block in __track': undefined method `model' for #<Gtk::ListStore:0x7fc4a00c0fc8 ptr=0x7fc4fd2635a0>
from {MIKUTTER_DIR}/core/mui/gtk_crud.rb:132:in `force_record_create'
from {MIKUTTER_DIR}/core/mui/gtk_crud.rb:160:in `record_create'
from {MIKUTTER_DIR}/core/mui/gtk_crud.rb:30:in `block in create_button'
from {MIKUTTER_DIR}/core/mui/gtk_extension.rb:22:in `call'
from {MIKUTTER_DIR}/core/mui/gtk_extension.rb:22:in `block in safety_signal_connect'
from {MIKUTTER_DIR}/core/mui/gtk_crud.rb:29:in `create_button'
from {MIKUTTER_DIR}/core/mui/gtk_crud.rb:24:in `buttons'
from {MIKUTTER_DIR}/core/plugin/extract/extract.rb:27:in `block (2 levels) in <top (required)>'
from {MIKUTTER_DIR}/core/plugin/settings/settings.rb:35:in `instance_eval'
from {MIKUTTER_DIR}/core/plugin/settings/settings.rb:35:in `block in setting_window'
from {MIKUTTER_DIR}/core/plugin/settings/settings.rb:30:in `each'
from {MIKUTTER_DIR}/core/plugin/settings/settings.rb:30:in `setting_window'
from {MIKUTTER_DIR}/core/plugin/settings/settings.rb:18:in `block (2 levels) in <top (required)>'
from {MIKUTTER_DIR}/core/event_listener.rb:25:in `call'
from {MIKUTTER_DIR}/core/event_listener.rb:25:in `update'
from /home/penguin/local/lib/ruby/2.0.0/observer.rb:195:in `block in notify_observers'
from /home/penguin/local/lib/ruby/2.0.0/observer.rb:194:in `each'
from /home/penguin/local/lib/ruby/2.0.0/observer.rb:194:in `notify_observers'
from {MIKUTTER_DIR}/core/event.rb:40:in `block (2 levels) in call'
from {MIKUTTER_DIR}/core/event.rb:40:in `catch'
from {MIKUTTER_DIR}/core/event.rb:40:in `block in call'
from {MIKUTTER_DIR}/core/delayer.rb:115:in `call'
from {MIKUTTER_DIR}/core/delayer.rb:115:in `run'
from {MIKUTTER_DIR}/core/delayer.rb:52:in `block (2 levels) in run'
from {MIKUTTER_DIR}/core/delayer.rb:48:in `each'
from {MIKUTTER_DIR}/core/delayer.rb:48:in `block in run'
from {MIKUTTER_DIR}/core/delayer.rb:44:in `times'
from {MIKUTTER_DIR}/core/delayer.rb:44:in `run'
from {MIKUTTER_DIR}/core/plugin/gtk/delayer.rb:26:in `block (2 levels) in on_regist'
from {MIKUTTER_DIR}/core/plugin/gtk/mainloop.rb:10:in `call'
from {MIKUTTER_DIR}/core/plugin/gtk/mainloop.rb:10:in `main'
from {MIKUTTER_DIR}/core/plugin/gtk/mainloop.rb:10:in `mainloop'
from {MIKUTTER_DIR}/mikutter.rb:58:in `boot!'
from {MIKUTTER_DIR}/mikutter.rb:76:in `<top (required)>'
from /home/penguin/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /home/penguin/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from {MIKUTTER_DIR}/mikutter_alt.rb:19:in `<main>'

model.model.appendとなっているが,modelだけでGtk::ListStoreが取得される.
Gtk::ListStoreにはmodelメソッドが定義されていないので,
その前にクラスチェックを入れるとクラッシュしなくなった.
model.model となっていた部分が2箇所あったので,両方にチェックを挟んだ.

--- a/core/mui/gtk_crud.rb
+++ b/core/mui/gtk_crud.rb
@@ -124,7 +124,11 @@ class Gtk::CRUD < Gtk::TreeView
   memoize :column_schemer

   def force_record_create(record)
-    iter = model.model.append
+    if model.class == Gtk::ListStore
+      iter = model.append
+    else
+      iter = model.model.append
+    end
     record.each_with_index{ |item, index|
       iter[index] = item }
     on_created(iter) end
@@ -140,7 +144,11 @@ class Gtk::CRUD < Gtk::TreeView
     if defined? model.convert_iter_to_child_iter(iter)
       iter = model.convert_iter_to_child_iter iter end
     on_deleted(iter)
-    model.model.remove(iter)
+    if model.class == Gtk::ListStore
+      model.remove(iter)
+    else
+      model.model.remove(iter)
+    end
   end

   def record_create(optional, widget)

Associated revisions

Revision 25f95d7c (diff)
Added by toshi_a 初音 over 6 years ago

抽出タブの作成/削除の際にmikutterがクラッシュする refs #579

History

#1

Updated by toshi_a 初音 over 6 years ago

  • Status changed from 新規 to レビュー待ち
  • Assignee set to Takuma Nakajima

もらったパッチとは違った方法ですが対応しました。確認してみてください。

#2

Updated by Takuma Nakajima over 6 years ago

  • Status changed from レビュー待ち to 解決

修正確認しました

#3

Updated by toshi_a 初音 over 6 years ago

  • Status changed from 解決 to 終了

Also available in: Atom PDF