As I said, cairo-pong.rb (in the ruby gtk samples) is a good way to
reproduce the bug: just let it run for a while.
You can also use the following program, grab the box and move it around,
it takes a while to get the crash (1 minute on my machine).
---- cairobug.rb — BEGIN ----
require ‘gtk2’
require ‘cairo’
class Canvas < Gtk::EventBox
def initialize
@bounds = [10, 10,100,100]
super
signal_connect('expose-event') { |widget, event|
cr = widget.window.create_cairo_context
cr.set_source_rgba(1.0, 1.0, 1.0)
cr.paint
cr.rectangle(*@bounds)
cr.set_source_rgb(0.5,0.0,0.0)
cr.fill_preserve
cr.set_source_rgb(0.7,0.7,0.7)
cr.set_line_join(Cairo::LINE_JOIN_MITER)
cr.set_line_width(2)
cr.stroke
}
signal_connect("button_press_event") do |widget, event|
@dragging=pt_in_rect([event.x, event.y], @bounds)
end
signal_connect("button_release_event") do |widget, event|
@dragging=false
end
signal_connect("motion_notify_event") do |widget, event|
if @dragging
queue_draw_area(@bounds[0] -2, @bounds[1] -2, @bounds[2]+4,
@bounds[3]+4)
@bounds[0] = event.x
@bounds[1] = event.y
queue_draw_area(@bounds[0] -2, @bounds[1] -2, @bounds[2]+4,
@bounds[3]+4)
end
end
end
def pt_in_rect(pt, rect)
(0..rect[2]).include?(pt[0]-rect[0]) &&
(0..rect[3]).include?(pt[1]-rect[1])
end
end
class MainWindow < Gtk::Window
def initialize
super
set_size_request(600, 400)
@canvas = Canvas.new
add(@canvas)
signal_connect(“destroy”) {
Gtk.main_quit
}
show_all
end
end
def main
Gtk.init
@main_window = MainWindow.new
Gtk.main
end
main
---- cairobug.rb — END -----
Enzo
Kouhei S. ha scritto:
This SF.Net email is sponsored by xPML, a groundbreaking scripting
language
that extends applications into web and mobile media. Attend the live
webcast
and join the prime developer group breaking into this new coding
territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642