[MacRuby-devel] [MacRuby] #721: Compiled ruby files return incorrect values for __FILE__

2010-05-18 Thread MacRuby
#721: Compiled ruby files return incorrect values for __FILE__
-+--
 Reporter:  m...@…   |   Owner:  lsansone...@…
 Type:  defect   |  Status:  new  
 Priority:  major|   Milestone:   
Component:  MacRuby  |Keywords:   
-+--
 Beginning with files "test_file.rb"

 {{{
 puts "__FILE__ = #{__FILE__}"
 }}}

 and "main.rb"

 {{{
 require 'test_file.rb'
 require 'test file.rbo'
 }}}

 arranged like this

 {{{
 /
   tmp
 ruby
   test_file.rb
 ruby2
   main.rb
 }}}

 I then issued the following commands starting in the /tmp directory

 {{{
 macruby -C ruby/test_file.rb -o ruby2/test_file.rbo
 mv ruby/test_file.rb ruby2
 cd ruby2
 macruby main.rb
 }}}

 and got the following results

 {{{
 __FILE__ = /tmp/ruby2/test_file.rb
 __FILE__ = ruby/test_file.rb
 }}}

 The incorrect __FILE__ values make it very difficult design a hierarchy of
 files and then load them using 'require' and relative paths for example.

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] MacRuby class inside obj-c

2010-05-18 Thread Louis-Philippe
Hi,
I don't know if this is the good list to ask this question as it is my
first...
So,

I saw how I can have a MacRuby cocoa app, importing objective-c classes.
I can't find info on how to do the opposite...  having an Objective-C cocoa
app, importing and using MacRuby Classes...

All I managed to do is to "evaluateFileAtPath:" and "evaluateString:"

Thanks!

L-P
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Using a context with addObserver

2010-05-18 Thread Laurent Sansonetti
Hi Dave,

Sorry for the late reply.

I'm afraid it's not currently possible to pass a string as an API that accepts 
a 'void *' (which seems to be your case). If you file a ticket on the tracker 
we can address this problem.

Your Pointer.new call may not raise a runtime exception but I suspect it's not 
going to behave correctly later.

I'm not familiar with the API you are using but it seems very uncommon to pass 
constants as context arguments to alter behaviors. Maybe there is another way 
to do what you want?

Laurent

On May 17, 2010, at 2:25 AM, Dave Baldwin wrote:

> Digging a bit more I think a solution to my own questions is:
> 
> On 13 May 2010, at 14:33, Dave Baldwin wrote:
> 
>> I am trying to translate code that looks like this:
>> 
>> static NSString *SKTWindowControllerCanvasSizeObservationContext = 
>> @"com.apple.SKTWindowController.canvasSize";
>> 
>> and later
>> 
>> [[self document] addObserver:self forKeyPath:SKTDocumentCanvasSizeKey 
>> options:NSKeyValueObservingOptionNew 
>> context:SKTWindowControllerCanvasSizeObservationContext];
>> 
>> to Ruby:
>> 
>> SKTWindowControllerCanvasSizeObservationContext = 
>> "com.apple.SKTWindowController.canvasSize"
> 
> SKTWindowControllerCanvasSizeObservationContext = Pointer.new(:char)
> 
> as all we are after is a unique value.  I still don't understand why the 
> original version wasn't acceptable as the documentation says the context 
> argument can be a C pointer or an object reference.  Anyhow, this has got me 
> past this point but I have still to prove the final result when it is used by 
> the observer.
> 
>> document.addObserver(self, forKeyPath: SKTDocumentCanvasSizeKey, 
>>  options: 
>> NSKeyValueObservingOptionNew,
>>  
>> context:SKTWindowControllerCanvasSizeObservationContext)
>> 
>> but when it runs I get this error:
>> 
>>  expected instance of Pointer, got 
>> `"com.apple.SKTWindowController.canvasSize"' (String) (TypeError)
>> 
>> How do I get the a pointer to the context string?  All the examples I have 
>> found for the Pointer class seem to expect an objective C routing to fill it 
>> in.
>> 
>> Thanks,
>> 
>> Dave.
>> 
>> 
> 
> Dave.
> 
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Anonymous class

2010-05-18 Thread Laurent Sansonetti
Hi,

Could you try to reduce the problem to a simple script and attach it to our 
tracker? It's hard to know what's wrong otherwise. Marshaling hashes (even 
those with singleton classes) is supposed to work

Thanks a lot in advance,

Laurent

On May 17, 2010, at 5:55 AM, Wladj wrote:

> Hi,
> 
> in a little macruby-cocoa app when i try to save a simple hash (attribute of 
> a model class) inside the fileWrapperOfType method via Marshal.load( 
> Marshal.dump(@model.data)) #deep copy , i get an error:
> 
> `fileWrapperOfType:error:': can't dump anonymous class # 
> (TypeError)
> 
> i discover that the hash attribute of the class is referenced as anonymous 
> class child of an Hash
> this happens with MacRuby 0.6 (also last nightly build), not with 0.5
> Thanks for any help and workaround
> Ciao
> 
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] MacRuby class inside obj-c

2010-05-18 Thread Laurent Sansonetti
Hi Louis-Philippe,

Assuming MacRuby code defines:

class Foo
  def initialize(message)
@message
  end
  def hello
puts "hello #{message}"
  end
end

You should be able to retrieve a reference to Foo using:

Class Foo = [[MacRuby sharedRuntime] evaluateString:@"Foo"];

Or, more simply:

Class foo = NSClassFromString(@"Foo");

You might want to use the first way in case the class has a complex path (if 
it's defined inside modules, like "Foo::Bar").

Later, you can send messages to it.

id obj = [Foo performRubySelector:@selector(new:) withArguments: @"objc", nil];
[obj performRubySelector:@selector(hello)];

Laurent

On May 18, 2010, at 2:31 PM, Louis-Philippe wrote:

> Hi,
> I don't know if this is the good list to ask this question as it is my 
> first...
> So,
> 
> I saw how I can have a MacRuby cocoa app, importing objective-c classes.
> I can't find info on how to do the opposite...  having an Objective-C cocoa 
> app, importing and using MacRuby Classes...
> 
> All I managed to do is to "evaluateFileAtPath:" and "evaluateString:"
> 
> Thanks!
> 
> L-P
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Using a context with addObserver

2010-05-18 Thread Dave Baldwin
Hi Laurent,

I am converting the Apple Sketch sample app to macruby and this construct is 
used everywhere.  My understanding (maybe faulty) is all they are trying to do 
is generate a unique pointer - pointing at a unique static string should do 
this, and by assigning it to a constant will show up compile errors if spelt 
wrong.

The context argument can just be a constant to allow the response to the 
observed behaviour to vary or it can be auxiliary information so this makes 
sense to me as you might need to know why, how or who caused something changed, 
rather than just the fact it has changed.

 In Ruby you would probably just use a symbol, but I presume this would throw 
up a run time error like a string does.

Dave.


On 18 May 2010, at 22:36, Laurent Sansonetti wrote:

> Hi Dave,
> 
> Sorry for the late reply.
> 
> I'm afraid it's not currently possible to pass a string as an API that 
> accepts a 'void *' (which seems to be your case). If you file a ticket on the 
> tracker we can address this problem.
> 
> Your Pointer.new call may not raise a runtime exception but I suspect it's 
> not going to behave correctly later.
> 
> I'm not familiar with the API you are using but it seems very uncommon to 
> pass constants as context arguments to alter behaviors. Maybe there is 
> another way to do what you want?
> 
> Laurent
> 
> On May 17, 2010, at 2:25 AM, Dave Baldwin wrote:
> 
>> Digging a bit more I think a solution to my own questions is:
>> 
>> On 13 May 2010, at 14:33, Dave Baldwin wrote:
>> 
>>> I am trying to translate code that looks like this:
>>> 
>>> static NSString *SKTWindowControllerCanvasSizeObservationContext = 
>>> @"com.apple.SKTWindowController.canvasSize";
>>> 
>>> and later
>>> 
>>> [[self document] addObserver:self forKeyPath:SKTDocumentCanvasSizeKey 
>>> options:NSKeyValueObservingOptionNew 
>>> context:SKTWindowControllerCanvasSizeObservationContext];
>>> 
>>> to Ruby:
>>> 
>>> SKTWindowControllerCanvasSizeObservationContext = 
>>> "com.apple.SKTWindowController.canvasSize"
>> 
>> SKTWindowControllerCanvasSizeObservationContext = Pointer.new(:char)
>> 
>> as all we are after is a unique value.  I still don't understand why the 
>> original version wasn't acceptable as the documentation says the context 
>> argument can be a C pointer or an object reference.  Anyhow, this has got me 
>> past this point but I have still to prove the final result when it is used 
>> by the observer.
>> 
>>> document.addObserver(self, forKeyPath: SKTDocumentCanvasSizeKey, 
>>> options: 
>>> NSKeyValueObservingOptionNew,
>>> 
>>> context:SKTWindowControllerCanvasSizeObservationContext)
>>> 
>>> but when it runs I get this error:
>>> 
>>>  expected instance of Pointer, got 
>>> `"com.apple.SKTWindowController.canvasSize"' (String) (TypeError)
>>> 
>>> How do I get the a pointer to the context string?  All the examples I have 
>>> found for the Pointer class seem to expect an objective C routing to fill 
>>> it in.
>>> 
>>> Thanks,
>>> 
>>> Dave.
>>> 
>>> 
>> 
>> Dave.
>> 
>> ___
>> MacRuby-devel mailing list
>> MacRuby-devel@lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] MacRuby class inside obj-c

2010-05-18 Thread Louis-Philippe
great!
I can even seem to send messages directly to my MacRuby classes and
instances...
like:
id obj = [Foo new:@"objc"];
and
[obj hello];

but in the second case I get a compiler warning: "No -hello method found"??

2010/5/18 Laurent Sansonetti 

> Hi Louis-Philippe,
>
> Assuming MacRuby code defines:
>
> class Foo
>  def initialize(message)
>@message
>  end
>  def hello
>puts "hello #{message}"
>  end
> end
>
> You should be able to retrieve a reference to Foo using:
>
> Class Foo = [[MacRuby sharedRuntime] evaluateString:@"Foo"];
>
> Or, more simply:
>
> Class foo = NSClassFromString(@"Foo");
>
> You might want to use the first way in case the class has a complex path
> (if it's defined inside modules, like "Foo::Bar").
>
> Later, you can send messages to it.
>
> id obj = [Foo performRubySelector:@selector(new:) withArguments: @"objc",
> nil];
> [obj performRubySelector:@selector(hello)];
>
> Laurent
>
> On May 18, 2010, at 2:31 PM, Louis-Philippe wrote:
>
> > Hi,
> > I don't know if this is the good list to ask this question as it is my
> first...
> > So,
> >
> > I saw how I can have a MacRuby cocoa app, importing objective-c classes.
> > I can't find info on how to do the opposite...  having an Objective-C
> cocoa app, importing and using MacRuby Classes...
> >
> > All I managed to do is to "evaluateFileAtPath:" and "evaluateString:"
> >
> > Thanks!
> >
> > L-P
> > ___
> > MacRuby-devel mailing list
> > MacRuby-devel@lists.macosforge.org
> > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Threading Problems

2010-05-18 Thread Jan Kassens
I traced the bug down to a small script, but can’t get it smaller than this: 
http://pastie.textmate.org/private/m21wkng3mgu7wvksbu4rq
According to the apple documentation [1] the Calendar Store framework is thread 
safe, but removing it removes the seg faults and bus errors I’m getting. It 
might just be Obj C calls from threads?

If this is a bug, I can file a ticket, but I might as well be doing something 
stupid here.

[1]: 
http://developer.apple.com/mac/library/documentation/AppleApplications/Reference/CalendarStoreReference/index.html


Jan


On May 15, 2010, at 21:24, Laurent Sansonetti wrote:

> Hi Jan,
> 
> Indeed this looks like a classic threading problem. I thought we eliminated 
> most of these in 0.6.
> 
> What does your #update method do specifically? Also, do the problems 
> disappear if you call #update only once from the main thread before starting 
> the thread?
> 
> A minor (but likely irrelevant here) note: I think your drawRect: method 
> might be called from the thread, which is AFAIK not supported in Cocoa. 
> 
> Laurent
> 
> On May 15, 2010, at 8:25 AM, Jan Kassens wrote:
> 
>> Hi,
>> 
>> I’m writing a small widget application rendering a couple of NSView 
>> subclasses which update periodically.
>> 
>> The widgets are subclasses of [1] and added as subviews to my main view, but 
>> the more I add the more likely are some random errors thrown on 
>> initialization.
>> The errors include a variety of failed assertions and seg faults (see [2] 
>> for examples) and don’t yield any helpful clues. I’m guessing that I’m 
>> dealing with something not thread-safe here.
>> 
>> Am I doing something wrong here? I’m doing all the drawing inside the 
>> drawRect(rect) method (or synchronously called methods) which I don’t call 
>> manually. “update” pulls data from various resources, but doesn’t draw.
>> 
>> 
>> [1] WidgetView class: 
>> http://pastie.textmate.org/private/hwfozrwudk2lcwzker20q
>> [2] Different Errors: http://pastie.textmate.org/private/vbp7iuw11ig26zxegzg
>> 
>> Jan
>> ___
>> MacRuby-devel mailing list
>> MacRuby-devel@lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Using a context with addObserver

2010-05-18 Thread Laurent Sansonetti
Hi Dave,

I see. If this pattern is used inside the Apple Sketch sample (so, in source 
code you control and not in a framework), then indeed passing a unique Pointer 
instance should do the trick.

There are probably better ways to do what you want without using the context 
argument, once you are done with the conversion I can have a look and see if it 
cannot be written differently :)

In any case, we should allow strings and/or symbols to be passed as 'void *' 
arguments. I will try to implement that later.

Thanks for porting this sample! 

Laurent

On May 18, 2010, at 3:05 PM, Dave Baldwin wrote:

> Hi Laurent,
> 
> I am converting the Apple Sketch sample app to macruby and this construct is 
> used everywhere.  My understanding (maybe faulty) is all they are trying to 
> do is generate a unique pointer - pointing at a unique static string should 
> do this, and by assigning it to a constant will show up compile errors if 
> spelt wrong.
> 
> The context argument can just be a constant to allow the response to the 
> observed behaviour to vary or it can be auxiliary information so this makes 
> sense to me as you might need to know why, how or who caused something 
> changed, rather than just the fact it has changed.
> 
>  In Ruby you would probably just use a symbol, but I presume this would throw 
> up a run time error like a string does.
> 
> Dave.
> 
> 
> On 18 May 2010, at 22:36, Laurent Sansonetti wrote:
> 
>> Hi Dave,
>> 
>> Sorry for the late reply.
>> 
>> I'm afraid it's not currently possible to pass a string as an API that 
>> accepts a 'void *' (which seems to be your case). If you file a ticket on 
>> the tracker we can address this problem.
>> 
>> Your Pointer.new call may not raise a runtime exception but I suspect it's 
>> not going to behave correctly later.
>> 
>> I'm not familiar with the API you are using but it seems very uncommon to 
>> pass constants as context arguments to alter behaviors. Maybe there is 
>> another way to do what you want?
>> 
>> Laurent
>> 
>> On May 17, 2010, at 2:25 AM, Dave Baldwin wrote:
>> 
>>> Digging a bit more I think a solution to my own questions is:
>>> 
>>> On 13 May 2010, at 14:33, Dave Baldwin wrote:
>>> 
 I am trying to translate code that looks like this:
 
 static NSString *SKTWindowControllerCanvasSizeObservationContext = 
 @"com.apple.SKTWindowController.canvasSize";
 
 and later
 
 [[self document] addObserver:self forKeyPath:SKTDocumentCanvasSizeKey 
 options:NSKeyValueObservingOptionNew 
 context:SKTWindowControllerCanvasSizeObservationContext];
 
 to Ruby:
 
 SKTWindowControllerCanvasSizeObservationContext = 
 "com.apple.SKTWindowController.canvasSize"
>>> 
>>> SKTWindowControllerCanvasSizeObservationContext = Pointer.new(:char)
>>> 
>>> as all we are after is a unique value.  I still don't understand why the 
>>> original version wasn't acceptable as the documentation says the context 
>>> argument can be a C pointer or an object reference.  Anyhow, this has got 
>>> me past this point but I have still to prove the final result when it is 
>>> used by the observer.
>>> 
 document.addObserver(self, forKeyPath: SKTDocumentCanvasSizeKey, 
options: 
 NSKeyValueObservingOptionNew,

 context:SKTWindowControllerCanvasSizeObservationContext)
 
 but when it runs I get this error:
 
  expected instance of Pointer, got 
 `"com.apple.SKTWindowController.canvasSize"' (String) (TypeError)
 
 How do I get the a pointer to the context string?  All the examples I have 
 found for the Pointer class seem to expect an objective C routing to fill 
 it in.
 
 Thanks,
 
 Dave.
 
 
>>> 
>>> Dave.
>>> 
>>> ___
>>> MacRuby-devel mailing list
>>> MacRuby-devel@lists.macosforge.org
>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>> 
>> ___
>> MacRuby-devel mailing list
>> MacRuby-devel@lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] MacRuby class inside obj-c

2010-05-18 Thread Laurent Sansonetti
Indeed, methods with normal arities (0..n arguments) conform to the Objective-C 
ABI, so using the bracket syntax just works. But for Ruby methods using complex 
arities (like splat or optional arguments), you will likely get a crash. This 
is why the -performRubySelector: method was introduced. It is better to always 
use that method, because it always works (in theory).

Laurent

On May 18, 2010, at 3:05 PM, Louis-Philippe wrote:

> great!
> I can even seem to send messages directly to my MacRuby classes and 
> instances...
> like:
> id obj = [Foo new:@"objc"];
> and
> [obj hello];
> 
> but in the second case I get a compiler warning: "No -hello method found"??
> 
> 2010/5/18 Laurent Sansonetti 
> Hi Louis-Philippe,
> 
> Assuming MacRuby code defines:
> 
> class Foo
>  def initialize(message)
>@message
>  end
>  def hello
>puts "hello #{message}"
>  end
> end
> 
> You should be able to retrieve a reference to Foo using:
> 
> Class Foo = [[MacRuby sharedRuntime] evaluateString:@"Foo"];
> 
> Or, more simply:
> 
> Class foo = NSClassFromString(@"Foo");
> 
> You might want to use the first way in case the class has a complex path (if 
> it's defined inside modules, like "Foo::Bar").
> 
> Later, you can send messages to it.
> 
> id obj = [Foo performRubySelector:@selector(new:) withArguments: @"objc", 
> nil];
> [obj performRubySelector:@selector(hello)];
> 
> Laurent
> 
> On May 18, 2010, at 2:31 PM, Louis-Philippe wrote:
> 
> > Hi,
> > I don't know if this is the good list to ask this question as it is my 
> > first...
> > So,
> >
> > I saw how I can have a MacRuby cocoa app, importing objective-c classes.
> > I can't find info on how to do the opposite...  having an Objective-C cocoa 
> > app, importing and using MacRuby Classes...
> >
> > All I managed to do is to "evaluateFileAtPath:" and "evaluateString:"
> >
> > Thanks!
> >
> > L-P
> > ___
> > MacRuby-devel mailing list
> > MacRuby-devel@lists.macosforge.org
> > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Threading Problems

2010-05-18 Thread Laurent Sansonetti
Hi Jan,

I tried your snippet but it works fine for me. I didn't get any crash. But your 
environment might differ from mine.

In any case, it should not crash, so please file a ticket and attach the crash 
log (or a full threads backtrace from gdb), and I will have a look :)

Thanks,

Laurent

On May 18, 2010, at 3:49 PM, Jan Kassens wrote:

> I traced the bug down to a small script, but can’t get it smaller than this: 
> http://pastie.textmate.org/private/m21wkng3mgu7wvksbu4rq
> According to the apple documentation [1] the Calendar Store framework is 
> thread safe, but removing it removes the seg faults and bus errors I’m 
> getting. It might just be Obj C calls from threads?
> 
> If this is a bug, I can file a ticket, but I might as well be doing something 
> stupid here.
> 
> [1]: 
> http://developer.apple.com/mac/library/documentation/AppleApplications/Reference/CalendarStoreReference/index.html
> 
> 
> Jan
> 
> 
> On May 15, 2010, at 21:24, Laurent Sansonetti wrote:
> 
>> Hi Jan,
>> 
>> Indeed this looks like a classic threading problem. I thought we eliminated 
>> most of these in 0.6.
>> 
>> What does your #update method do specifically? Also, do the problems 
>> disappear if you call #update only once from the main thread before starting 
>> the thread?
>> 
>> A minor (but likely irrelevant here) note: I think your drawRect: method 
>> might be called from the thread, which is AFAIK not supported in Cocoa. 
>> 
>> Laurent
>> 
>> On May 15, 2010, at 8:25 AM, Jan Kassens wrote:
>> 
>>> Hi,
>>> 
>>> I’m writing a small widget application rendering a couple of NSView 
>>> subclasses which update periodically.
>>> 
>>> The widgets are subclasses of [1] and added as subviews to my main view, 
>>> but the more I add the more likely are some random errors thrown on 
>>> initialization.
>>> The errors include a variety of failed assertions and seg faults (see [2] 
>>> for examples) and don’t yield any helpful clues. I’m guessing that I’m 
>>> dealing with something not thread-safe here.
>>> 
>>> Am I doing something wrong here? I’m doing all the drawing inside the 
>>> drawRect(rect) method (or synchronously called methods) which I don’t call 
>>> manually. “update” pulls data from various resources, but doesn’t draw.
>>> 
>>> 
>>> [1] WidgetView class: 
>>> http://pastie.textmate.org/private/hwfozrwudk2lcwzker20q
>>> [2] Different Errors: http://pastie.textmate.org/private/vbp7iuw11ig26zxegzg
>>> 
>>> Jan
>>> ___
>>> MacRuby-devel mailing list
>>> MacRuby-devel@lists.macosforge.org
>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>> 
>> ___
>> MacRuby-devel mailing list
>> MacRuby-devel@lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> ___
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Threading Problems

2010-05-18 Thread Caius Durling
On 19 May 2010, at 00:19, Laurent Sansonetti wrote:

> I tried your snippet but it works fine for me. I didn't get any crash. But 
> your environment might differ from mine.


Out of interest I tried his snippet, and it segfaulted for me too.

https://gist.github.com/7f75c2aa6bd1544befab has my crash report. I'm running 
0.6 stable installed from the .pkg.

HTH,
C
---
Caius Durling
ca...@caius.name
+44 (0) 7960 268 100
http://caius.name/

___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] [MacRuby] #722: Multiple Threads are causing Segmentation Faults

2010-05-18 Thread MacRuby
#722: Multiple Threads are causing Segmentation Faults
--+-
 Reporter:  jankass...@…  |   Owner:  lsansone...@…
 Type:  defect|  Status:  new  
 Priority:  blocker   |   Milestone:   
Component:  MacRuby   |Keywords:   
--+-
 This little script causes segmentation faults on my machine (unibody
 MacBook with Core 2 Duo)
 (using the 0.6 release version)
 {{{
 #!/usr/bin/env macruby
 framework 'calendarstore'
 50.times do
   Thread.new do
 loop do
   pred = CalCalendarStore.eventPredicateWithStartDate(NSDate.date,
 endDate:NSDate.date,
 calendars:CalCalendarStore.defaultCalendarStore.calendars)
   CalCalendarStore.defaultCalendarStore.eventsWithPredicate(pred)
   sleep 1
 end
   end
 end
 sleep 1
 }}}

 Most common is this error:
 {{{
 $ ./test.rb
 unknown: [BUG] Segmentation fault
 MacRuby version 0.6 (ruby 1.9.0) [universal-darwin10.0, x86_64]

 Abort trap
 }}}
 but I get this as well:
 {{{
 $ ./test.rb
 SEGV recieved in SEGV handler
 unknown: SEGV recieved in SEGV handler
 }}}

 Since the programm exits on the seg fault, I didn't manage to get a
 backtrace with macrubyd.

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #696: net/ftp doesn't work

2010-05-18 Thread MacRuby
#696: net/ftp doesn't work
---+
 Reporter:  daniel.fonta...@…  |   Owner:  pthom...@…
 Type:  defect |  Status:  assigned  
 Priority:  blocker|   Milestone:
Component:  MacRuby|Keywords:
---+
Changes (by pthom...@…):

  * owner:  lsansone...@… => pthom...@…
  * status:  new => assigned


Comment:

 Looks like a problem with socket-based I/O.
 You can call #readline or #gets once on an FTP socket, but further
 invocations get stuck inside an infinite loop in rb_io_read_internal().

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #722: Multiple Threads are causing Segmentation Faults

2010-05-18 Thread MacRuby
#722: Multiple Threads are causing Segmentation Faults
--+-
 Reporter:  jankass...@…  |   Owner:  lsansone...@…
 Type:  defect|  Status:  new  
 Priority:  blocker   |   Milestone:   
Component:  MacRuby   |Keywords:   
--+-

Comment(by jankass...@…):

 caius posted a crash report: https://gist.github.com/7f75c2aa6bd1544befab

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel