Discussion Board

Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    Nokia Developer Champion vineet.jain's Avatar
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    3,841
    Just thinking, why are you loading an icon if there's some error.As mentioned in the edited code in #14, you may give it a try.

  2. #17
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Mallorca, Holiday
    Posts
    27,683
    Now I see the workaround you have tried. But you need the other way.
    Similarly to the items, the listbox also owns the icons by default. Which means that the icon array and its elements are destroyed by the listbox. The problem starts when duplicate pointers appear in the list: deletion of the first occurrence succeeds, and deletion attempt of the second one is a KERN-EXEC 3. Even when only one occurrence is there in the list, the icon gets deleted without your AppUi knowing about it. It will cause the same kind of KERN-EXEC 3 when exiting the application, and it can also cause nasty problems if you re-run the same listbox again (because Folder_icon will be an invalid pointer by that time).
    A little bit hacky, but working approach could be keeping the ownership for yourself, and deleting the icons in a for loop with a check: if the given pointer equals to Folder_icon, do not delete it, otherwise delete. Then the array itself at the end. This way Folder_icon would remain a valid pointer no matter the number of its usages.
    More elegant approach would be putting Folder_icon as first element in your array, and re-use it with a constant 0-index when building the item array. Assuming that you build the icon array and the item array at the same time, it should not be a big problem. However in this case you still have to avoid deletion of Folder_icon. Keeping ownership of the array, and deliberately NULL-ing its first element can enable ResetAndDestroy-type of deletion (deleting a NULL pointer is a valid operation in C++). Then you do not need tricky for loops, just "array->ResetAndDestroy" and "delete array".
    Or, you can follow this latter approach, just with re-creating folder_icon for every instantiation of your listbox. This way the listbox can own the icon array, and will destroy folder_icon too, but only once.

  3. #18
    Registered User shizzl's Avatar
    Join Date
    Mar 2012
    Posts
    60
    Or, you can follow this latter approach, just with re-creating folder_icon for every instantiation of your listbox.
    yeah, thats what i did and it seems to be working. Did not know that a pointer can cause that trouble..

    Thanks for your support!

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Created icons doesn't showup,Only default icons shown
    By shintu in forum [Archived] Qt Quick
    Replies: 2
    Last Post: 2011-11-06, 15:59
  2. Third party icons and Anna icons for Symbian 3 using carbide.4.1
    By d627699993 in forum Themes/Carbide.ui
    Replies: 1
    Last Post: 2011-07-29, 19:10
  3. Icons in CAKnListQueryDialog
    By gmsk19 in forum Symbian User Interface
    Replies: 3
    Last Post: 2007-10-24, 10:46
  4. Adding list icons and problems with 3rd party icons
    By breakdesign in forum Themes/Carbide.ui
    Replies: 0
    Last Post: 2007-06-11, 06:26

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved