Re: Crash when dispaying document in iChat Theater

2008-04-21 Thread Kevin Grant

Is the view drawing on a thread other than the main thread?
That might not be allowed (I'm not sure about Cocoa...in
Carbon this was never possible).

For the doesNotRecognizeSelector case, do you see any compiler
warnings about this?  That would at least show if it's your
code that's referring to a potentially nonexistent routine,
as opposed to the system.

Kevin G.



Hi,

I'm trying to implement iChat Theater capability into my garbage  
collected app, and it looks to be almost working, except for a  
rather all important crash. When my app is notified that it should  
start sending video it executes the following code:


IMAVManager *manager = [IMAVManager sharedAVManager];
MyDocument *d;

switch ([manager state])
{
case IMAVRequested:
			d = [[NSDocumentController sharedDocumentController]  
documentForURL:[manager URLToShare]];

if (d == nil) {
d = [[NSDocumentController sharedDocumentController]  
openDocumentWithContentsOfURL:[manager URLToShare] display:YES];

}
[manager setVideoDataSource:d.someView];
[manager start];
break;
}

someView has subviews, including a PDFView subclass. I have tried  
setting the data source to the PDFView and to the PDFView's  
documentView, but the result is always the same.


When I start a session the theater mode activates and I can see my  
document in the iChat window. All is well until anything causes a  
redraw of the view being displayed, at which point there is either a  
crash, or an error that leads to a crash if I try to continue  
execution. Here are the backtraces of the two types of crash:


#0  0x956bb6e8 in objc_msgSend ()
#1  0x90a2f337 in _pixelBufferReleaseCallback ()
#2  0x93079d78 in CVPixelBufferBacking::finalize ()
#3  0x9307242e in CVPixelBuffer::finalize ()
#4  0x90a21de9 in -[IMAuxVideoProvider _fillBufferFromPool:atRate:] ()
#5  0x90a21bfe in -[IMAuxVideoProvider _callbackThreadMain] ()
#6  0x95d735ad in -[NSThread main] ()
#7  0x95d73154 in __NSThread__main__ ()
#8  0x95440c55 in _pthread_start ()
#9  0x95440b12 in thread_start ()


#0  0x956b00d7 in objc_exception_throw ()
#1  0x927e844a in -[NSObject doesNotRecognizeSelector:] ()
#2  0x927e6a4c in ___forwarding___ ()
#3  0x927e6b12 in __forwarding_prep_0___ ()
#4  0x90a2f337 in _pixelBufferReleaseCallback ()
#5  0x93079d78 in CVPixelBufferBacking::finalize ()
#6  0x9307242e in CVPixelBuffer::finalize ()
#7  0x90a21de9 in -[IMAuxVideoProvider _fillBufferFromPool:atRate:] ()
#8  0x90a21bfe in -[IMAuxVideoProvider _callbackThreadMain] ()
#9  0x95d735ad in -[NSThread main] ()
#10 0x95d73154 in __NSThread__main__ ()
#11 0x95440c55 in _pthread_start ()
#12 0x95440b12 in thread_start ()

The second problem (doesNotRecognizeSelector:) I've so far only seen  
once, usually there is a straight crash (bad access). This looks  
like a framework bug to me, but I thought I'd ask here if anybody  
has any other ideas, or similar experience to share, before filing a  
bug report.


-António

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Crash when dispaying document in iChat Theater

2008-04-21 Thread Antonio Nunes

On Apr 21, 2008, at 4:55 PM, Kevin Grant wrote:


Is the view drawing on a thread other than the main thread?
That might not be allowed (I'm not sure about Cocoa...in
Carbon this was never possible).


No, it all happens on the main thread.


For the doesNotRecognizeSelector case, do you see any compiler
warnings about this?  That would at least show if it's your
code that's referring to a potentially nonexistent routine,
as opposed to the system.


This doesn't even happen in any part of my code. It happens within the  
Instant Messaging framework. After a bit more digging, I'm pretty  
convinced this is a garbage collection related issue, and I've filed a  
bug report.


...

In fact, I just had the bright idea to compile Mark Alldritt's iCheat  
Theater Demo with garbage collection turned on. And, although it isn't  
quite as eager to do it as my app, it eventually crashes with the same  
type of error. Just need to wiggle the mouse for a while while holding  
the window's resize knob. WIth GC off I can wiggle all I want for over  
a minute and every thing's just fine.


Thanks for the suggestions though.

António

---
What you have inside you expresses itself through both your
choice of words and the level of energy you assign to them.
The more healed, whole and connected you feel inside,
the more healing your words will be.

--Rita Goswami
---


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Crash when dispaying document in iChat Theater

2008-04-21 Thread Antonio Nunes

On Apr 21, 2008, at 5:52 PM, Quincey Morris wrote:

If d is a local variable, as this code fragment seems to say, what's  
keeping it (and therefore d.someView) from getting garbage collected  
as soon as it goes out of scope? 'setVideoDataSource' is documented  
to *not* retain the view (in non-GC), and I would take such a  
statement to mean that it does not hold a keep-alive reference to  
the object (in GC) either.


d is a local variable indeed, but it is just an intermediate  
instrument, one that points to a document that is held' by the  
document controller. The object d points to remains connected to a  
root object by being held by the controller.


Just in case: turning of the collector for variable d doesn't make a  
difference. Stil crashes.


António

---
And you would accept the seasons of your
heart, even as you have always accepted
the seasons that pass over your field.

--Kahlil Gibran
---



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]