I am developing a desktop program using ruby-gnome2 and datamapper.
the problem is: gtk UI will hang up after a period of time that
datamapper connection is established.
GTK UI won't refresh even when other window moves over it. but it
responds to close button.
Anybody met this problem?

my environment:

windowsXP SP3
ruby1.8.7p72 i386-mswin32
dm-core 0.9.11
do_sqlite3 0.9.12
do_mysql 0.9.12

I tried sqlite3 and the latest mysql adapter(mswin32), both the same
problem.
I follow ruby-gtk with multithread guide, put DB operation in
Gtk.init_add, but nothing changed:
http://ruby-gnome2.sourceforge.jp/hiki.cgi?tips_threads

the demo code:

require 'datamapper'
require 'do_sqlite3'
require 'gtk2'

class Member
  include DataMapper::Resource

  property :id, Integer, :serial => true
  property :name, String
end

DataMapper.setup(:default, :adapter => 'sqlite3',
        :database => 'memory')

# this line will establish a DB connection, and operates migrations.
# and this line will establish a new Thread, I think it represent a DB
connection
# and it most like the original source of problem in ruby-GTK-win.
DataMapper.auto_migrate!(:default)

class MainWindow < Gtk::Window
  def initialize
    super()

    @content = Gtk::VBox.new
    self.add(@content)

    label = Gtk::Label.new("Content")
    @content.add(label)

    button = Gtk::Button.new("quit")
    @content.pack_start(button, false, false)
    button.signal_connect('clicked') do
      Gtk.main_quit
    end

    self.set_size_request(400,400)

    self.signal_connect('delete_event') do
      Gtk.main_quit
    end
  end
end

MainWindow.new.show_all

Gtk.main





--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to