[Kde-bindings] qtruby improvements

Davor Ocelic docelic at spinlocksolutions.com
Tue Sep 22 19:13:05 UTC 2009


Hello folks,

We have an application that, under Ruby 1.9, sometimes crashed with
"Object allocation during garbage collection phase".

In Ruby 1.8, it didn't want to start at all, exiting with that error
right away on startup every time.

Attached patch with 4 simple changes fixes this and some other
issues.

Here's an overview of the changes:

ruby/qtruby/src/handlers.cpp:

Added { "unsigned char*", marshall_ucharP } so that conversion
from String to "unsigned char*" would work. Qt code doesn't
have unsigned char*, but Smoke seems to internally convert
uchar* to unsigned char*.

ruby/qtruby/src/Qt.cpp:

The code at the place of patch checks whether a method is overriden
in Ruby. But during GC, it's not allowed to execute Ruby code anyway,
so we skip this check. (In rare, but existing situations, the check
itself lead to new object allocation, crashing the application).

ruby/qtruby/src/lib/Qt/qtruby4.rb

1) Added GC.disable around line of code that says: "@block = block".
This makes a difference between being and being not able to run
with GC.stress= true. Reason unclear, comments appreciated.

2) Extended typename =~ /^(?:u?char\*)$/ checks to support 
unsigned char.

3) Skip "def instance_exec" if it is already defined
(it is in Ruby 1.9)

Best regards,
Davor Ocelic
Spinlock Solutions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kdebindings-22sep2009.patch
Type: text/x-patch
Size: 2394 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-bindings/attachments/20090922/a58904ec/attachment.patch>


More information about the Kde-bindings mailing list