What causes a UITableViewCell to be deallocated?

2012-01-23 Thread Laurent Daudelin
Hello.

I'm trying to track a crash in our app where we have a custom UITableView cell 
that contains a UITextView because we need the ability to display and open 
links that might be in the text we're displaying in the text view.

The problem is that somehow, the cell is deallocated and WebKit complains that 
it's been unable to obtain the web lock from a thread other than the main 
thread or the web thread when it's deallocated. I have reviewed the code and 
checked all the reload… message we might send to the table view that could 
cause the deallocation of its cells but all of those calls are executed from 
the main thread using [[NSOperationQueue mainQueue] addOperationWithBlock:^{…}] 
so I'm stumped. Are there any other situations where UITableView cells would be 
deallocated? The view displays and the view isn't unloaded due to memory 
warning or any other situation.

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://www.nemesys-soft.com/
Logiciels Nemesys Software  
laur...@nemesys-soft.com


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: What causes a UITableViewCell to be deallocated?

2012-01-23 Thread Luke Hiesterman
Think about it simply. A cell gets deallocated just like any other object - 
when its retain count goes to zero. If you're looking for a cell getting 
deallocated on a non-main thread, you're looking for a place release is being 
called on a non-main thread. I would think you could just override the dealloc 
method to help you track this situation in the debugger. Perhaps add an 
NSAssert([NSThread isMainThread], @wups); in there.

Luke

On Jan 23, 2012, at 11:38 AM, Laurent Daudelin wrote:

 Hello.
 
 I'm trying to track a crash in our app where we have a custom UITableView 
 cell that contains a UITextView because we need the ability to display and 
 open links that might be in the text we're displaying in the text view.
 
 The problem is that somehow, the cell is deallocated and WebKit complains 
 that it's been unable to obtain the web lock from a thread other than the 
 main thread or the web thread when it's deallocated. I have reviewed the code 
 and checked all the reload… message we might send to the table view that 
 could cause the deallocation of its cells but all of those calls are executed 
 from the main thread using [[NSOperationQueue mainQueue] 
 addOperationWithBlock:^{…}] so I'm stumped. Are there any other situations 
 where UITableView cells would be deallocated? The view displays and the view 
 isn't unloaded due to memory warning or any other situation.
 
 -Laurent.
 -- 
 Laurent Daudelin
 AIM/iChat/Skype:LaurentDaudelin   
 http://www.nemesys-soft.com/
 Logiciels Nemesys Software
 laur...@nemesys-soft.com
 
 
 ___
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com
 
 This email sent to luket...@apple.com


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: What causes a UITableViewCell to be deallocated?

2012-01-23 Thread Laurent Daudelin
It seems that the deallocation happens when a block is being deallocated. Is it 
possible that a block ran on the main queue of an NSOperationQueue could be 
deallocated in another thread?

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://www.nemesys-soft.com/
Logiciels Nemesys Software  
laur...@nemesys-soft.com

On Jan 23, 2012, at 13:49, Laurent Daudelin wrote:

 Hello Luke.
 
 Well, I already checked that. The cell is being deallocated from a secondary 
 thread but there is nothing in the thread that indicates what triggered it. 
 It looks like a performSelector:withObject:afterDelay: or something like it 
 but we don't have any of those in the table view controller that controls the 
 table view. Like I said in my original message, I've looked for any flavor of 
 UITableView reload… and the only calls we have are reloadData but they are 
 all executed on the main thread using [[NSOperationQueue] mainQueue] 
 addOperationWithBlock: so I'm stumped as to where this deallocation is 
 triggered. I've checked all the other running threads and I can't find any 
 code that you reload the table view which could cause its cells to be 
 deallocated.
 
 -Laurent.
 -- 
 Laurent Daudelin
 AIM/iChat/Skype:LaurentDaudelin   
 http://www.nemesys-soft.com/
 Logiciels Nemesys Software
 laur...@nemesys-soft.com
 
 On Jan 23, 2012, at 13:38, Luke Hiesterman wrote:
 
 Think about it simply. A cell gets deallocated just like any other object - 
 when its retain count goes to zero. If you're looking for a cell getting 
 deallocated on a non-main thread, you're looking for a place release is 
 being called on a non-main thread. I would think you could just override the 
 dealloc method to help you track this situation in the debugger. Perhaps add 
 an NSAssert([NSThread isMainThread], @wups); in there.
 
 Luke
 
 On Jan 23, 2012, at 11:38 AM, Laurent Daudelin wrote:
 
 Hello.
 
 I'm trying to track a crash in our app where we have a custom UITableView 
 cell that contains a UITextView because we need the ability to display and 
 open links that might be in the text we're displaying in the text view.
 
 The problem is that somehow, the cell is deallocated and WebKit complains 
 that it's been unable to obtain the web lock from a thread other than the 
 main thread or the web thread when it's deallocated. I have reviewed the 
 code and checked all the reload… message we might send to the table view 
 that could cause the deallocation of its cells but all of those calls are 
 executed from the main thread using [[NSOperationQueue mainQueue] 
 addOperationWithBlock:^{…}] so I'm stumped. Are there any other situations 
 where UITableView cells would be deallocated? The view displays and the 
 view isn't unloaded due to memory warning or any other situation.
 
 -Laurent.
 -- 
 Laurent Daudelin
 AIM/iChat/Skype:LaurentDaudelin 
 http://www.nemesys-soft.com/
 Logiciels Nemesys Software  
 laur...@nemesys-soft.com
 
 
 ___
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com
 
 This email sent to luket...@apple.com
 
 


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: What causes a UITableViewCell to be deallocated?

2012-01-23 Thread Steve Christensen
A UITableViewCell could be deallocated as soon as its row scrolls out of view. 
UITableView will reuse cells if you specify a reuse identifier, but I don't 
believe that the docs actually specify the number of cells that are reused.

I'm assuming that the web view is displayed when the user taps a link in the 
UITextView. If so, when does the crash occur relative to the appearance of the 
web view?


On Jan 23, 2012, at 11:38 AM, Laurent Daudelin wrote:

 I'm trying to track a crash in our app where we have a custom UITableView 
 cell that contains a UITextView because we need the ability to display and 
 open links that might be in the text we're displaying in the text view.
 
 The problem is that somehow, the cell is deallocated and WebKit complains 
 that it's been unable to obtain the web lock from a thread other than the 
 main thread or the web thread when it's deallocated. I have reviewed the code 
 and checked all the reload… message we might send to the table view that 
 could cause the deallocation of its cells but all of those calls are executed 
 from the main thread using [[NSOperationQueue mainQueue] 
 addOperationWithBlock:^{…}] so I'm stumped. Are there any other situations 
 where UITableView cells would be deallocated? The view displays and the view 
 isn't unloaded due to memory warning or any other situation.


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: What causes a UITableViewCell to be deallocated?

2012-01-23 Thread Laurent Daudelin
Steve,

There are no web views. Because we're using a UITextView, it loads the WebKit 
behind the scene (I guess to support links that could appear in the text in the 
UITextView) and when that UITextView is deallocated from another thread than 
the main thread or the webkit thread, it raises an exception that crashes the 
app. This happens only in iOS 4.3.5. I'm not sure if all my UITableView 
operations are run on the main thread why when that block is deallocated, it 
would be on a secondary thread. That seems to be the problem.

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://www.nemesys-soft.com/
Logiciels Nemesys Software  
laur...@nemesys-soft.com

On Jan 23, 2012, at 15:49, Steve Christensen wrote:

 A UITableViewCell could be deallocated as soon as its row scrolls out of 
 view. UITableView will reuse cells if you specify a reuse identifier, but I 
 don't believe that the docs actually specify the number of cells that are 
 reused.
 
 I'm assuming that the web view is displayed when the user taps a link in the 
 UITextView. If so, when does the crash occur relative to the appearance of 
 the web view?
 
 
 On Jan 23, 2012, at 11:38 AM, Laurent Daudelin wrote:
 
 I'm trying to track a crash in our app where we have a custom UITableView 
 cell that contains a UITextView because we need the ability to display and 
 open links that might be in the text we're displaying in the text view.
 
 The problem is that somehow, the cell is deallocated and WebKit complains 
 that it's been unable to obtain the web lock from a thread other than the 
 main thread or the web thread when it's deallocated. I have reviewed the 
 code and checked all the reload… message we might send to the table view 
 that could cause the deallocation of its cells but all of those calls are 
 executed from the main thread using [[NSOperationQueue mainQueue] 
 addOperationWithBlock:^{…}] so I'm stumped. Are there any other situations 
 where UITableView cells would be deallocated? The view displays and the view 
 isn't unloaded due to memory warning or any other situation.
 


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com