Did anyone have any success with using the Content Listing Framework ? I'm getting a KERN EXEC-3 panic when trying it in the emulator, and Code Warrior wouldn't reveal the call stack.
I also want to question the design of this API. First off, ContentListingFactory provides only functions ending in LC, which are only suitable if you store the resulted pointers as automatic variables on the stack. If you want to store those as member variables of a C-class, the only way to do it is to explicitly pop (but not destroy) the result off the cleanup stack.
Another oddity is that the factory functions return M-classes. E.g. "static IMPORT_C MCLFContentListingEngine * ContentListingFactory::NewContentListingEngineLC()". If you push an M-class pointer on the cleanup stack, like this does, and later try to pop and destroy it with validity checking, you'll get a panic.
E.g.
MCLFContentListingEngine* engine = ContentListingFactory::NewContentListingEngineLC();
CleanupStack::PopAndDestroy(engine); // Will panic
So clearly returning pointers to M-classes from a factory function is not a good idea. This aside, the next issue arise.
MCLFItemListModel::RefreshL() is an asynchronous function that completes through a callback part of MCLFOperationObserver, not through the usual TRequestStatus. Getting an instance of MCLFItemListModel is through "MCLFItemListModel* MCLFContentListingEngine::CreateListModelLC(MCLFOperationObserver & aObserver)". If really the purpose of providing LC factories was to force people to use automatic variables for holding the results, then by the time the call to RefreshL completes asynchronously, those automatic variables would be gone, because the call stack would have unwound. This is I believe a conceptual mismatch in the design of the API. One could perhaps employ a nested scheduler to prolong the life of those automatic variables until the callback returns, but that would be overly complex.
An easier approach is to store the result of CreateListModelLC in a member variable of a C-class that stays alive until the callback finishes. Doing that causes a KERN EXEC-3 panic even before the callback gets called.
For me this API seems totally unusable, I wonder if others had better luck.



