Discussion Board

Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    Nokia Developer Champion
    Join Date
    Jun 2008

    Re: CAknListQueryDialog with icons

    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
    Join Date
    Feb 2006
    Oslo, Norway

    Re: CAknListQueryDialog with icons

    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
    Join Date
    Mar 2012

    Re: CAknListQueryDialog with icons

    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!

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. Icons in CAKnListQueryDialog
    By gmsk19 in forum Symbian User Interface
    Replies: 3
    Last Post: 2007-10-24, 10:46

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts