Hi list,
I just found the solution.
If I call super() inside the hide method everything works fine.
def hide()
# do some cleanup stuff here
# ...
super
end
regards,
andy
-------- Original-Nachricht --------
Message-ID: <
50640A9F...@siberas.de>
Date: Thu, 27 Sep 2012 10:13:19 +0200
From: Andreas Schmidt <
wat...@siberas.de>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120907
Thunderbird/15.0.1
MIME-Version: 1.0
To:
fxruby...@rubyforge.org
Subject: Clipboard problem on Linux
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit
Dear list,
I get a FXRuby crash on a Linux box ( on Windows everything works fine)
when I work with clipboard data. The crash occurs when I try to paste
data from an already closed dialog box. It happens only when I override
the hide() method of an dialog box.
This is the message I get from the programm:
FXRbText::setDNDData: window has not yet been created.
Aborted
Here's the code to reproduce the crash:
--- code ---
#!/usr/bin/env ruby
require 'fox16'
include Fox
class MyText < FXDialogBox
include Responder
def initialize(owner)
# Invoke base class initialize function first
super(owner, "Text", :opts => DECOR_ALL,:width=>300, :height=>150)
@log_text_dt = FXDataTarget.new('This is a crash test.')
@log_viewer = FXText.new(self, :target => @log_text_dt, :selector
=> FXDataTarget::ID_VALUE, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
@log_viewer.editable = true
@log_viewer.enabled = true
end
def hide()
# do some cleanup stuff here
# ...
self.destroy
end
end
class MTTextTest < FXMainWindow
def initialize(app)
# Call base class initializer first
super(app, "Clipboard Crash", :width => 400, :height => 200)
frame = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
@textbox = FXText.new(frame, :opts =>
LAYOUT_FILL_X|LAYOUT_FILL_Y|TEXT_AUTOSCROLL)
showButton = FXButton.new(frame, "Open Text Window", :opts =>
FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_TOP|LAYOUT_LEFT)
showButton.connect(SEL_COMMAND) do
begin
mrtk = MyText.new(FXApp.instance)
mrtk.create
mrtk.show(Fox::PLACEMENT_SCREEN)
rescue => bang
puts "!!! could not open manual request"
puts bang
end
end
end
# Create and show the main window
def create
super # Create the windows
show(PLACEMENT_SCREEN) # Make the main window appear
end
end
if __FILE__ == $0
# Construct the application object
application = FXApp.new('ClipBoard Crash', 'FoxTest')
# Construct the main window
scribble = MTTextTest.new(application)
# Create the application
application.create
application.run
end
--- end of code ---
System Infos:
root@bt:~/Desktop# ruby -v
ruby 1.9.2dev (2010-07-02) [i486-linux]
root@bt:~/Desktop# ruby -e "require 'fox16'; puts Fox.fxversion"
1.6.36
Steps to reproduce the crash:
1) open a textbox and copy some data (ctrl-c)
2) close the textbox
3) open a second textbox and paste the data (ctrl-v)
4) crash
Is this a FXRuby bug or my fault?
Or is there another way to catch the hide method? Because I need to
clean-up some threads before the window gets closed.
BTW, I need it for my open-source project
http://watobo.sourceforge.net.
Thanks for any hint,
-andy
_______________________________________________
fxruby-users mailing list
fxruby...@rubyforge.org
http://rubyforge.org/mailman/listinfo/fxruby-users