Thread: RE: [Fxruby-users] Error: FXRbGetRubyObj(this=0x084e7fb8) returns non-Qnil
Status: Inactive
Brought to you by:
lyle
From: Daniel S. <da...@pr...> - 2004-03-14 22:35:06
|
I've experienced the same (or similar) problem - same error messages anyway. I don't believe that it is related to the overriding of the objects.=20 Have a look at the code at http://sourceforge.net/tracker/index.php?func=3Ddetail&aid=3D913892&group= _id =3D20243&atid=3D120243 - it provides as little code as I could to reprodu= ce the problem. Are there any common elements with your code? I have a feeling the segfault is caused by a race condition involved in the disposal code of either the treelist or the treeitem object, due to the fact that adding profiling to the code also introduces the segfault (see http://sourceforge.net/tracker/index.php?func=3Ddetail&aid=3D913892&group= _id =3D20243&atid=3D120243) > -----Original Message----- > From: Hal Fulton [mailto:ha...@hy...]=20 > Sent: Sunday, 14 March 2004 10:23 PM > To: fxr...@li... > Subject: [Fxruby-users] Error:=20 > FXRbGetRubyObj(this=3D0x084e7fb8) returns non-Qnil >=20 >=20 > I've been rewriting my tree logic and it's much cleaner and=20 > shorter now. >=20 > I subclass TopicItem < FXTreeItem and TopicTree < FXTreeList=20 > -- then I override addItemLast to create a TopicItem; and=20 > then call super with that item; and then return the item. >=20 > But I'm getting an error every time I click a tree item (see=20 > subject line). The object id differs. >=20 > Partial code below. (For the whole thing, see=20 > tycho.rubyforge.org and run mkdata.rb first.) >=20 > However, it all works fine besides the error message, EXCEPT=20 > that it segfaults when I hit the Quit button. >=20 > Ideas??? >=20 > Thanks, > Hal >=20 >=20 >=20 >=20 >=20 > class TopicItem < FXTreeItem >=20 > attr_accessor :dir, :path, :title, :notes >=20 > def initialize(dir,path,title) > super(title) > @dir, @path =3D dir, path > @notes =3D [] > end >=20 > end >=20 > #################################################### >=20 > class TopicTree < FXTreeList >=20 > Index =3D "index.yaml" >=20 > def addItemLast(parent,dir,path,title) > item =3D TopicItem.new(dir,path,title) > super(parent,item) > item > end >=20 > def expand > self.expandTree(@treetop) > end >=20 > def initialize(contain,root_dir) > tree_opts =3D=20 > FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_TOP| > =20 > LAYOUT_RIGHT|TREELIST_SHOWS_LINES|TREELIST_SHOWS_BOXES| > TREELIST_ROOT_BOXES|TREELIST_EXTENDEDSELECT > super(contain, 0, nil, 0, tree_opts) > @treetop =3D nil > load(nil,root_dir) > end >=20 > def load(parent,root) > current =3D nil > Dir.chdir(root) do > # Load index for this dir > info =3D File.open(Index) {|f| ::YAML.load(f) } # error=20 > if not there > title =3D info[0]['title'] > current =3D self.addItemLast(parent,root,Dir.pwd,title) > @treetop =3D current if @treetop.nil? >=20 > # Load all files as notes > files =3D Dir.all_files - [Index] > current.notes =3D files.map {|x| Note.new(x) } >=20 > # Recurse and load directories as topics > Dir.all_dirs.each {|dir| load(current,dir) } > end > end >=20 > end >=20 >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President=20 > and CEO of GenToo technologies. Learn everything from=20 > fundamentals to system=20 > administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dc= lick > _______________________________________________ > Fxruby-users mailing list > Fxr...@li... > https://lists.sourceforge.net/lists/listinfo/fxruby-users >=20 #########################################################################= ############ This email has been scanned by MailMarshal, an email content filter. #########################################################################= ############ |
From: Daniel S. <da...@pr...> - 2004-03-15 04:15:04
|
It looks to me like calling any of the connect() methods on a treelist is prone to error (my code was with SEL_DELETED and SEL_INSERTED on a treelist) I've edited your tycho.rb file by deleting a bunch of code. I've added code into two places (marked with -- daniels). It appears that the pim.main.tree.connect(SEL_COMMAND) is the root problem. Comment out that section and it exits cleanly. --------------- require "fox" require "yaml" #################################################### include Fox FillXY =3D LAYOUT_FILL_X|LAYOUT_FILL_Y Sunken_FillXY =3D FRAME_SUNKEN|LAYOUT_FILL_X|LAYOUT_FILL_Y #################################################### class TopicTree < FXTreeList =20 Index =3D "index.yaml" =20 def addItemLast(parent,dir,path,title) =20 #item =3D TopicItem.new(dir,path,title) =20 # -- daniels =20 item =3D FXTreeItem.new(title) =20 super(parent,item) =20 item =20 end =20 def expand =20 self.expandTree(@treetop) =20 end =20 def initialize(contain,root_dir) =20 tree_opts =3D FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_TOP| =20 LAYOUT_RIGHT|TREELIST_SHOWS_LINES|TREELIST_SHOWS_BOXES|= =20 TREELIST_ROOT_BOXES|TREELIST_EXTENDEDSELECT =20 super(contain, 0, nil, 0, tree_opts) =20 @treetop =3D nil =20 load(nil,root_dir) =20 end =20 def load(parent,root) =20 current =3D nil =20 Dir.chdir(root) do =20 # Load index for this dir =20 info =3D File.open(Index) {|f| ::YAML.load(f) } # error if not th= ere =20 title =3D info[0]['title'] =20 current =3D self.addItemLast(parent,root,Dir.pwd,title) =20 @treetop =3D current if @treetop.nil? =20 end =20 end end #################################################### class MyMain < FXMainWindow =20 attr_reader :right, :tree =20=20 =20 def initialize(app) =20 super(app,"Tycho (version #{Tycho::VERSION})",nil,nil,DECOR_ALL) =20 @rest =3D FXHorizontalFrame.new(self,FillXY) =20 @split =3D FXSplitter.new(@rest, Sunken_FillXY) =20 @left =3D FXVerticalFrame.new(@split,Sunken_FillXY, 0,0,0,0, 0,0,0,= 0)=20 =20 @note_widgets =3D [] =20 =20 =20 @tree =3D TopicTree.new(@left,"exper/data") =20=20 =20 end =20 def create =20 super # Do base-class create first =20 @left.width =3D 1.5*@tree.contentWidth # Make left pane wide enoug= h =20 self.height =3D 480 =20 self.width =3D 680 =20 show(PLACEMENT_SCREEN) # Show main window =20 end end #################################################### class Tycho =20 attr_reader :main, :app =20 VERSION =3D "0.0.4" =20 def initialize =20 super =20 @app =3D FXApp.new("Tycho","myself") =20 @app.init(ARGV) =20 @main =3D MyMain.new(@app) =20 end end #################################################### # "Main"... pim =3D Tycho.new pim.main.tree.connect(SEL_COMMAND) do |sender,sel,ptr| =20 # -- daniels =20 puts "This is the problem" =20 #pim.main.show_notes(ptr.notes) end pim.app.create pim.app.run #########################################################################= ############ This email has been scanned by MailMarshal, an email content filter. #########################################################################= ############ |
From: Daniel S. <da...@pr...> - 2004-03-15 04:26:04
|
If you move this code: pim.main.tree.connect(SEL_COMMAND) do |sender,sel,ptr| =20 pim.main.show_notes(ptr.notes) end Up into the creation of the tree =20 @tree =3D TopicTree.new(@left,"exper/data") =20 @tree.connect(SEL_COMMAND) do |sender,sel,ptr| =20 pim.main.show_notes(ptr.notes) =20 end =20 @tree.expand And the segfault goes away. Don't ask me why. #########################################################################= ############ This email has been scanned by MailMarshal, an email content filter. #########################################################################= ############ |
From: Hal F. <ha...@hy...> - 2004-03-15 03:45:55
|
Daniel Sheppard wrote: > I've experienced the same (or similar) problem - same error messages > anyway. > > I don't believe that it is related to the overriding of the objects. > > Have a look at the code at > http://sourceforge.net/tracker/index.php?func=detail&aid=913892&group_id > =20243&atid=120243 - it provides as little code as I could to reproduce > the problem. Are there any common elements with your code? > > I have a feeling the segfault is caused by a race condition involved in > the disposal code of either the treelist or the treeitem object, due to > the fact that adding profiling to the code also introduces the segfault > (see > http://sourceforge.net/tracker/index.php?func=detail&aid=913892&group_id > =20243&atid=120243) It's not obvious to me what the commonality is. What *is* interesting is that it segfaults on Linux the same as on Windows. Now that's cross-platform! ;) Hal |