×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Aug 2010
    Posts
    347

    A question about CleanupStack Push() and Pop()

    Hello list,

    My assumption is that the CleanupStack exists until the program exits.
    So, would it be correct to assume that if an object is pushed on to the CleanupStack from one routine, it can be popped and destroyed in another routine, perhaps in a different file? This is assuming that the programmer is sure that what is popped and destroyed from the CleanupStack in a different routine, is the same object that was pushed on to the CleanupStack from the previous routine?

    Appreciate your comments.

    TIA
    Vin

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,165

    Re: A question about CleanupStack Push() and Pop()

    what you suggesting does not make too much sense, and would definetely have high chance introducing additional panics to your applciation, thus I would recommend forgetting about trying a such thing.

  3. #3
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,748

    Re: A question about CleanupStack Push() and Pop()

    The programmer has to make sure that it is popping the right objects in the right order. Technically it often happens that you push something on it in one 'file' and pop in an other. For example when you are invoking NewLC of something, that NewLC method is usually somewhere else, either in an other .cpp file, or even in an other .dll.
    The rules are simple:
    - if your method is an LC method, it is expected leave something on the Cleanup Stack
    - if your method is not an LC method, it is not expected to leave anything on the Cleanup Stack

Similar Threads

  1. CleanupStack push and pops
    By lokesh_kumar_s in forum Symbian
    Replies: 4
    Last Post: 2010-07-11, 16:49
  2. KERN-EXEC 3 when pop-ing up item from CleanupStack
    By juannoguera in forum Symbian
    Replies: 4
    Last Post: 2009-06-29, 12:55
  3. CleanUpStack::Pop&Destroy(Tint)
    By arungupta_2jan in forum Symbian
    Replies: 2
    Last Post: 2008-04-15, 14:26
  4. CleanupStack::Pop and CleanupStack::PopAndDestroy
    By julppoupou in forum Symbian
    Replies: 1
    Last Post: 2003-07-14, 06:54

Posting Permissions

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