Project

General

Profile

Actions

Bug #3531

closed

segmentation fault caused by etc/activation.rb (wxruby)

Added by ntys (ding ding) almost 12 years ago. Updated about 11 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32]
Backport:
[ruby-core:31024]

Description

=begin
E:\wxruby\samples\etc>ruby activation.rb
Frame 'Tall window' became activated
Frame 'Tall window' became deactivated
Frame 'Wide window' became activated
Frame 'Wide window' became deactivated
Frame 'Tall window' became activated
activation.rb:54: [BUG] Segmentation fault
ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32]

-- control frame ----------
c:0010 p:---- s:0028 b:0028 l:000027 d:000027 CFUNC :get_title
c:0009 p:0064 s:0025 b:0023 l:000022 d:000022 METHOD activation.rb:54
c:0008 p:0012 s:0019 b:0019 l:0011b0 d:000018 BLOCK activation.rb:36
c:0007 p:---- s:0016 b:0016 l:000015 d:000015 FINISH
c:0006 p:---- s:0014 b:0014 l:000013 d:000013 CFUNC :call
c:0005 p:---- s:0012 b:0012 l:000011 d:000011 CFUNC :on_run
c:0004 p:---- s:0010 b:0010 l:000009 d:000009 CFUNC :main_loop
c:0003 p:0092 s:0007 b:0007 l:00095c d:001670 EVAL activation.rb:101
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:00095c d:00095c TOP

-- Ruby level backtrace information-----------------------------------------
activation.rb:54:in get_title' activation.rb:54:in on_activate'
activation.rb:36:in block in initialize' activation.rb:101:in call'
activation.rb:101:in on_run' activation.rb:101:in main_loop'
activation.rb:101:in `'

[NOTE]
You may encounter a bug of Ruby interpreter. Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

E:\wxruby\samples\etc>type activation.rb
#!/usr/bin/env ruby

wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team

Freely reusable code: see SAMPLES-LICENSE.TXT for details

begin
require 'rubygems'
rescue LoadError
end
require 'wx'

This sample demonstrates the use of Activate Events. These are

generated when a frame becomes active or inactive. This is typically

indicated by a frame's titlebar changing colour, and a widget within

the frame gainin focus. An event is also generated when a whole wxRuby

app starts or stops being the current focussed desktop application.

class MinimalFrame < Wx::Frame
def initialize(title, pos, size, style = Wx::DEFAULT_FRAME_STYLE)
super(nil, -1, title, pos, size, style)

 menuFile = Wx::Menu.new()
 helpMenu = Wx::Menu.new()
 helpMenu.append(Wx::ID_ABOUT, "&About...\tF1", "Show about dialog")
 menuFile.append(Wx::ID_EXIT, "E&xit\tAlt-X", "Quit this program")
 menuBar = Wx::MenuBar.new()
 menuBar.append(menuFile, "&File")
 menuBar.append(helpMenu, "&Help")
 set_menu_bar(menuBar)

 create_status_bar(2)
 set_status_text("Welcome to wxRuby!")

 evt_menu(Wx::ID_EXIT) { on_quit }
 evt_menu(Wx::ID_ABOUT) { on_about }

 evt_activate { | e | on_activate(e) }
 evt_iconize  { | e | on_iconize(e) }

end

def on_iconize(event)
if event.iconized
puts "Frame '#{get_title}' was iconized"
else
puts "Frame '#{get_title}' was restored"
end
end

def on_activate(event)
if event.get_active
puts "Frame '#{get_title}' became activated"
set_status_text 'Active'
else
puts "Frame '#{get_title}' became deactivated"
set_status_text 'Inactive'
end
event.skip # important
end

def on_quit
Wx::get_app.close_all
end

def on_about
msg = sprintf("This is the About dialog of the activate sample.\n"
"Welcome to wxRuby, version %s", Wx::WXRUBY_VERSION)
Wx::message_box(msg, "About Activate", Wx::OK|Wx::ICON_INFORMATION, self)
end
end

class RbApp < Wx::App
def on_init
@frame_1 = MinimalFrame.new("Tall window",
Wx::Point.new(50, 50),
Wx::Size.new(150, 240))
@frame_2 = MinimalFrame.new("Wide window",
Wx::Point.new(100, 100),
Wx::Size.new(300, 180))
evt_activate_app { | e | on_activate_app(e) }
@frame_1.show()
@frame_2.show()

end

def on_activate_app(event)
if event.get_active
puts "The app became active"
else
puts "The app became inactive"
end
event.skip # important
end

def close_all
@frame_1.close(true)
@frame_2.close(true)
end
end

app = RbApp.new
app.main_loop()

####well , maybe it's not ruby's fault.
=end

Actions #1

Updated by tenderlovemaking (Aaron Patterson) almost 12 years ago

  • Status changed from Open to Feedback

=begin
It looks like there is a specific way to install wxruby with Ruby 1.9. Did you use that procedure?

http://www.ruby-forum.com/topic/187872
http://rubyforge.org/frs/?group_id=35
=end

Updated by naruse (Yui NARUSE) about 11 years ago

  • Status changed from Feedback to Rejected

timeout

Actions

Also available in: Atom PDF