Hi Laurent:
Thanks for your quick reply. I have attached another file that causes
a similar crash without a call to autorelease.
Bob Rice
#
# OutlineRowNode.rb
# Cocoa-Ruby Driver Assistant
#
# Created by Robert Rice on 9/4/09.
# Copyright (c) 2009 Rice Audio. All rights reserved.
#
require 'ReadLogNew'
class OutlineRowNode
include FileSystemFunctions
Months = [ "January", "Feburary", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]
def init
# super
@initialized = false
@path = ""
@object = nil
@level = 0
@dirname = ""
@filename = ""
@columnValues = Array.new
@columnColors = Array.new
@children = NSMutableArray.alloc.init
@parent = nil
self
end
attr_accessor :path, :dirname, :filename
attr_writer :columnValues, :columnColors, :level, :parent, :object
attr_reader :children
def count; @children.count; end
def value; @dirname + @filename; end
def Populate
NSLog( "numberOfChildrenOfItem #...@path} #...@dirname}" )
# if not @initialized
case @level
when 0; GetDirs() # Year
when 1; GetDirs() # Month
when 2; GetFiles() # Days
when 3; GetEvents()
end
@initialized = true
# end
@children.count
end
def GetColumnObject( tableColumn )
return nil if @object == nil
column = tableColumn.identifier.to_i - 1
column = 0 if column < 0
@object.at( column )
end
def Expandable
# NSLog( "isItemExpandable #...@path} #...@dirname}" )
@level < 4
end
def ToolTip( tableColumn )
column = tableColumn.identifier.to_i
NSLog( "toolTipForCell_rect_tableColumn_item_mouseLocation #...@path}, #{column}" )
obj = self.GetColumnObject( tableColumn )
return "" if obj == nil
obj.ToolTip( column )
end
def ColumnColor( tableColumn )
column = tableColumn.identifier.to_i
if @columnColors == false
obj = self.GetColumnObject( tableColumn )
return "" if obj == nil
return obj.TableColor( column )
end
@columnColors.at( column )
end
def childAtIndex( index )
# NSLog( "child_ofItem #{index}, #...@path} #...@dirname}" )
@children.objectAtIndex( index )
end
def WillDisplayCell( cell, tableColumn )
column = tableColumn.identifier.to_i
# NSLog( "willDisplayCell_forTableColumn_item #...@path}, #{column}" )
if cell.font != "Times"
font = NSFont.fontWithName_size_( "Times", 14.0 )
cell.setFont_( font )
color = ColumnColor( tableColumn )
color = NSColor.blackColor if color == nil
cell.setTextColor_( color )
end
cell.setMenu_( nil ) # Clear previous menu
return if column < 2 or @parent == nil
obj = self.GetColumnObject( tableColumn )
if obj != nil
menu = obj.ContextMenu( @parent, column )
cell.setMenu_( menu ) if menu != nil # Set menu for this cell
end
end
def ColumnValue( tableColumn )
column = tableColumn.identifier.to_i
# NSLog( "objectValueForTableColumn_byItem #...@path} #...@dirname} column #{column}" )
if @columnValues == false
obj = self.GetColumnObject( tableColumn )
return "" if obj == nil
return obj.TableValue( column )
end
@columnValues.at( column )
end
def GetDirs
path = ( @level == 0 ? @path : "#...@path}/#...@dirname}" )
dirlist = GetDirectories( path )
NSLog( dirlist.inspect )
return if count() == dirlist.length
@children.removeAllObjects
dirlist.each do | dirname |
grp = OutlineRowNode.alloc.init
grp.path = path
grp.dirname = dirname
grp.columnValues = [ @level == 1 ? Months.at( dirname.to_i - 1 ) : dirname ]
grp.columnColors = [ NSColor.darkGrayColor ]
grp.parent = self
grp.level = @level + 1
@children.addObject( grp )
end
end
def GetFiles
path = "#...@path}/#...@dirname}"
filelist = Array.new
GetDataFiles( path ).each do | filename |
filelist << filename if filename.length == 8
end
return if count() == filelist.length
@children.removeAllObjects
filelist.each do | filename |
grp = OutlineRowNode.alloc.init
grp.path = path
grp.filename = filename
grp.columnValues = [ filename ]
grp.columnColors = [ ]
grp.parent = self
grp.level = @level + 1
@children.addObject( grp )
end
end
def ReloadTable
NSLog( "ReloadTable #{value()}" )
@initialized = false
Model.instance.outlineView.reloadItem_reloadChildren_( self, true ) # Refresh the table
end
def GetEvents
date = ModelDate.alloc.InitWithString( @filename, false )
date.setToUTC
driverList = Model.instance.DriverList # Not fully initialized first pass
# Build table of events
eventTable = Array.new
tableRow = Array.new
tableTime = "25:00:00"
eventList = Model.instance.EventTable( date )
eventList.each do | event |
case event.class.to_s
when "StartOfDay"; displayColumn = -1 # not displayed
when "HistoryEvent"
displayColumn = -1 # not displayed
event.parentItem = self
when "StopEvent", "DriveEvent", "TripEvent", "VehicleEvent", "DriverRecord"
displayColumn = 1 # Shared event column
when "LogEvent", "ExpenseEvent"
displayColumn = driverList.index( event.driver ).to_i + 2
else; displayColumn = 0
end
if displayColumn >= 0
if event.time > tableTime or ( tableRow[ displayColumn ] != nil )
eventTable << tableRow
tableRow = Array.new
tableTime = event.time
end
tableRow[ displayColumn ] = event
end
end
eventTable << tableRow if not tableRow.empty?
dvrColumns = Model.instance.outlineView.tableColumns
col = 3
Model.instance.driverRecords.each do | driverRec | # Update column headers
tableColumn = dvrColumns.at( col )
tableColumn.headerCell.setStringValue( "Driver " + driverRec.driver )
tableColumn.sizeToFit
tableColumn.setHidden_( false )
col += 1
end
while true
tableColumn = dvrColumns.at( col )
break if tableColumn == nil
tableColumn.setHidden_( true )
col += 1
end
@children.removeAllObjects
eventTable.each do | tableRow |
grp = OutlineRowNode.alloc.init
grp.object = tableRow
grp.columnValues = false
grp.columnColors = false
grp.parent = self
grp.level = @level + 1
@children.addObject( grp )
end
Model.instance.OpenTableDate( self, @filename ) # Notify Model date is expanded
end
def dealloc
@children = nil
# super_dealloc
end
end
On Sep 23, 2009, at 3:24 PM, Laurent Sansonetti wrote:
Hi Robert,
The problem is line 68, the call to autorelease. If you remove it it
should load again. The reason is that autorelease (like release and
retain) are ignored selectors of the runtime. Clearly we should not
crash this way, I will fix that.
Also, keep in mind that retain, release and autorelease should not
be used in MacRuby. We run under GC mode which makes these calls no-
ops.
Laurent
On Sep 23, 2009, at 12:18 PM, Robert Rice wrote:
Hi Laurent:
Thanks for your offer to help. Sorry I was busy with another
project but now I get back to MacRuby.
I have attached a file that causes the assertion error when loaded
by the require command. Probably there is something else I need to
change when porting from Ruby-Cocoa.
Thanks,
Bob Rice
<JBH_F7575101_WindowController.rb>
On Sep 12, 2009, at 3:08 PM, Laurent Sansonetti wrote:
Hi Robert,
Unless you found what was wrong, feel free to contact me off-list
with a copy of your app and I will investigate the problem.
Laurent
On Sep 12, 2009, at 9:48 AM, Robert Rice wrote:
Hi Laurent:
It's a relatively large application that I ported from a
RubyCocoa environment.
I need the threading support hook that was removed from Ruby in
the Snow Leopard release.
I'll try to track it down better by porting and testing modules a
little at a time.
Thanks,
Bob Rice
On Sep 11, 2009, at 12:53 PM, Laurent Sansonetti wrote:
Looks like we are hitting an assertion in the symbol
generator... Could you send us what you are trying to execute
here?
Laurent
Sent from my iPhone
On Sep 11, 2009, at 9:48 AM, Robert Rice <[email protected]>
wrote:
How would I track down the following error from the nightly
build?
[Session started at 2009-09-11 12:43:22 -0400.]
GNU gdb 6.3.50-20050815 (Apple version gdb-1344) (Fri Jul 3
01:19:56 UTC 2009)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public
License, and you are
welcome to change it and/or distribute copies of it under
certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty"
for details.
This GDB was configured as "x86_64-apple-darwin".tty /dev/ttys000
Loading program into debugger…
Program loaded.
run
[Switching to process 326]
Running…
Assertion failed: (1==0), function rb_intern3, file parse.y,
line 9596.
Program received signal: “SIGABRT”.
sharedlibrary apply-load-rules all
warning: Could not find object file "/Users/mattetti/src/
macruby-gitsvn/trunk/array.o" - no debug information available
for "array.c".
warning: Could not find object file "/Users/mattetti/src/
macruby-gitsvn/trunk/bignum.o" - no debug information available
for "bignum.c".
...
Thanks,
Bob Rice
On Sep 10, 2009, at 2:24 PM, Matt Aimonetti wrote:
Latest trunk code available as an unofficial pkg ready to
install: http://rubyurl.com/5K3W
Lots of bug fixes, improved macgem (not finished yet but you
can install gems and load them using `gem 'gem_name'; require
'whatever'`).
Things are looking pretty good on trunk :)
- Matt
_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel