From: Stefan S. <ma...@ss...> - 2016-01-03 14:39:22
|
Dear Mr Kouhei Sutou, have you ever tested rcairo for cairo library compiled with xlib-xcb xcb support? cairo-1.14.6 was compiled with that options on my Gentoo AMD64 Linux box, and I discovered yesterday that my program http://ssalewski.de/PetEd.html.en crashed when I started it with command "ruby peted.rb" and immediately closed that empty window by clicking the cross on top right corner. That is for ruby-gnome2-3.0.7, ruby 2.2 and GTK 3.16. I had no idea about the crash (segmentation fault). I tested cairo -pong.rb, that works fine. Now I recompiled cairo without xlib-xcb xcb options, and crash is gone. That is not a big problem for me currently, my program is still unfinished and I can use cairo without lib-xcb xcb. Later, if other people may use my program with lib-xcb xcb enabled it may be a problem. Of course my program may have a serious bug. But I wonder why the crash occurs only with cairo options lib-xcb xcb. And just clicking the cross on top right corner direct after startup is a simple operation, there is no code which is executed in my program. I have noticed that I can avoid the crash when I start it with a file argument like "ruby peted.rb test.sch" and move some symbols around before terminating the program. And generally the program seems to work the same with and without cairo options lib-xcb xcb. Problem is only termination, but debugging that is really difficult. Best regards, Stefan Salewski |
From: Kouhei S. <ko...@co...> - 2016-01-03 15:11:17
|
Hi, In <145...@ss...> "[ruby-gnome2-devel-en] Crashes when cairo is compiled with xlib-xcb xcb options" on Sun, 03 Jan 2016 15:19:58 +0100, Stefan Salewski <ma...@ss...> wrote: > cairo-1.14.6 was compiled with that options on my Gentoo AMD64 Linux > box, and I discovered yesterday that my program > http://ssalewski.de/PetEd.html.en crashed when I started it with command > "ruby peted.rb" and immediately closed that empty window by clicking the > cross on top right corner. Could you get C level backtrace? segv-handler-gdb gem will help you: https://github.com/kou/segv-handler-gdb % gem install segv-handler-gdb % ruby -rsegv-handler-gdb peted.rb (crashed) % ls /tmp/segv-handler-gdb* Thanks, -- kou |
From: Stefan S. <ma...@ss...> - 2016-01-03 19:45:35
|
On Mon, 2016-01-04 at 00:11 +0900, Kouhei Sutou wrote: > Could you get C level backtrace? > > segv-handler-gdb gem will help you: This is my first attempt to debug, is it helpful for you? http://ssalewski.de/tmp/debug.txt |
From: Kouhei S. <ko...@co...> - 2016-01-04 12:38:10
|
Hi, In <145...@ss...> "Re: [ruby-gnome2-devel-en] Crashes when cairo is compiled with xlib-xcb xcb options" on Sun, 03 Jan 2016 20:45:24 +0100, Stefan Salewski <ma...@ss...> wrote: > On Mon, 2016-01-04 at 00:11 +0900, Kouhei Sutou wrote: >> Could you get C level backtrace? >> >> segv-handler-gdb gem will help you: > > This is my first attempt to debug, is it helpful for you? > > http://ssalewski.de/tmp/debug.txt Thanks. It seems that your cairo XCB surface is destroyed twice. It may be caused by Ruby's sweep (in GC) timing. Ruby script can't control object order to be swept. It seems that your script was finished by exception. Could you confirm that your script raises any exception? For example: --- # ... begin Gtk.main rescue Exception puts "#{$!.class}: #{$!}" puts $@ end --- Thanks, -- kou |
From: Stefan S. <ma...@ss...> - 2016-01-08 20:04:41
|
On Fri, 2016-01-08 at 20:40 +0100, Stefan Salewski wrote: > I will see if I can replace this call. Done! @surf = @darea.window.create_similar_surface(Cairo::CONTENT_COLOR_ALPHA, @darea.allocation.width + 2 * $OFFSET, @darea.allocation.height + 2 * $OFFSET) creates the background surface without need for a intermediate cairo context and seems to work without crashes! But currently my whole Ruby system is all compiled with -O0 and full debugging enabled, I have to recompile and test with full speed still. Thanks for your support, Stefan Salewski |
From: Kouhei S. <ko...@co...> - 2016-01-09 13:56:21
|
Hi, In <145...@ss...> "Re: [ruby-gnome2-devel-en] Crashes when cairo is compiled with xlib-xcb xcb options" on Fri, 08 Jan 2016 21:04:33 +0100, Stefan Salewski <ma...@ss...> wrote: > @surf = @darea.window.create_similar_surface(Cairo::CONTENT_COLOR_ALPHA, @darea.allocation.width + 2 * $OFFSET, @darea.allocation.height + 2 * $OFFSET) > > creates the background surface without need for a intermediate cairo > context and seems to work without crashes! Good! Alternatively, adding "other.destroy" may fix the crash: @surf = other.create_similar(Cairo::CONTENT_COLOR_ALPHA, @darea.allocation.width + 2 * $OFFSET, @darea.allocation.height + 2 * $OFFSET) other.destroy Thanks, -- kou |
From: Stefan S. <ma...@ss...> - 2016-01-04 18:04:10
|
On Mon, 2016-01-04 at 21:38 +0900, Kouhei Sutou wrote: > > It seems that your cairo XCB surface is destroyed twice. > It may be caused by Ruby's sweep (in GC) timing. Ruby script > can't control object order to be swept. > > > It seems that your script was finished by exception. > Could you confirm that your script raises any exception? > > For example: > > --- > # ... > > begin > Gtk.main > rescue Exception > puts "#{$!.class}: #{$!}" > puts $@ > end > --- > > The code is still exactly the same as in http://ssalewski.de/pet20150928.tar I had no spare time since then to work on it. At the end of peted.rb there is no exception, only plain Gtk.main at the end. And for termination of the program there is self.signal_connect('destroy') {Gtk.main_quit} in file peted.rb |
From: Stefan S. <ma...@ss...> - 2016-01-06 14:38:57
|
On Mon, 2016-01-04 at 19:04 +0100, Stefan Salewski wrote: > > The code is still exactly the same as in > > http://ssalewski.de/pet20150928.tar > > I had no spare time since then to work on it. > > At the end of peted.rb there is no exception, only plain > > Gtk.main > > at the end. > > And for termination of the program there is > > self.signal_connect('destroy') {Gtk.main_quit} > > in file peted.rb > > > Hello, what really is strange: When I put GC.disable in file peted.rb here end # module PetEd GC.disable options = Hash.new I get the same crash when I immediately terminate the program after startup. So may the bug exist in Cairo C lib itself? Well, Gmome is using Cairo too, gschem too, all seems to be OK. But maybe my Ruby code calls something of Cairo C lib what is buggy? I think there are some Linux Window managers out there which use XCB, so some people may have Cairo compiled with XCB unfortunately. |
From: Stefan S. <ma...@ss...> - 2016-01-06 15:08:03
|
On Wed, 2016-01-06 at 15:38 +0100, Stefan Salewski wrote: > Hello, > > what really is strange: > > When I put GC.disable in file peted.rb here > > > end # module PetEd > > GC.disable > > options = Hash.new > This is the debugger log when GC is dissabled: http://ssalewski.de/tmp/log.txt |
From: Stefan S. <ma...@ss...> - 2016-01-08 19:40:40
|
On Mon, 2016-01-04 at 21:38 +0900, Kouhei Sutou wrote: > It seems that your cairo XCB surface is destroyed twice. Have tried to debug it with gdb, but without real success. Yesterday I tried to comment out parts of my code. My current feeling is that I have in pet-canvas.rb @darea.signal_connect('configure-event') { darea_configure_callback } darea_configure_callback() calls function paint(), where I have cr0 = @darea.window.create_cairo_context If I comment out that line, the bug is gone. But I need that to create a similar surface for my background pattern! I have no idea why that may generate the crash, why only with xcb, and why not when I have moved some elements on my schematic sheet. I will see if I can replace this call. For the draw event it is easy to replace, I get the cairo context as a parameter for the called block. I really should replace that. But for configure-event that is not that easy. My intent was to create a similar surface for maximum performance, and I think for that I need a cairo context. But a plain image surface may work for testing. |