Strange crash (interpreter bug?)

S

Sylvain Joyeux

I was trying to fix the busy_handler of the sqlite3. (version 1.1.0 makes
the interpreter crash)

Rewriting busy_handler in lib/sqlite3/native/driver.rb from

def busy_handler( db, data=nil, &block )
if block
cb = API::CallbackData.new
cb.proc = block
cb.data = data
end

API.sqlite3_busy_handler( db,
block ? API::Sqlite3_ruby_busy_handler : nil, cb )
end


to

def busy_handler( db, data=nil, &block )
if block
cb = API::CallbackData.new
cb.proc = block
cb.data = data
API.sqlite3_busy_handler( db, API::Sqlite3_ruby_busy_handler, cb)
else
API.sqlite3_busy_handler( db, nil, nil)
end
end

fixed the problem (at least on my system)

For me, those two functions are strictly equivalent. So ... where's the
difference ?
 
S

Sylvain Joyeux

If you call the first busy_handler without a block, cb isn't
declared when calling Sqlite3_ruby_busy_handler.
Does not seem so ... The code does run. The problem is a *crash* (i.e.
segfault).
 
T

ts

S> Does not seem so ... The code does run. The problem is a *crash* (i.e.
S> segfault).

I don't know what is a crash. Can you give a *small* example to reproduce
the problem, and your ruby version.


Guy Decoux
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,199
Messages
2,571,045
Members
47,643
Latest member
ashutoshjha_1101

Latest Threads

Top