[fxruby-users] Clipboard problem on Linux

Nataraj S Narayan natarajsn at gmail.com
Thu Sep 27 08:54:23 UTC 2012


Hi Andy

Didn't get the crash after copying and closing and copying into the
ruby sample app text box.

I am on ruby 1.9.3 p194 and Fox 1.6.46.

regards

Nataraj



On Thu, Sep 27, 2012 at 1:43 PM, Andreas Schmidt <watobo at siberas.de> wrote:
> 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 at bt:~/Desktop# ruby -v
> ruby 1.9.2dev (2010-07-02) [i486-linux]
> root at 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-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/fxruby-users


More information about the fxruby-users mailing list