×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    23

    How can I delete a RHttpDownload?

    I use the Download Manager API, success to start(),pause() a RHttpDownload,but can't delete() it.

    Code:
    CDownloadArray& array = const_cast<CDownloadArray&>(iDMgr.CurrentDownloads());
        RHttpDownload aDownload = *array[idx];
        aDownload.GetIntAttribute(EDlAttrState,status);
            
        switch (aCommand) {
        case EMnDownStart:        
            if(status==EHttpDlCreated || status==EHttpDlPaused)
                aDownload.Start();
            break;
        case EMnDownPause:        
            if(status==EHttpDlInprogress)
                aDownload.Pause();
            break;
        case EMnDownStop:
            if(iContainer){
                LOG(_L("delete a download.11111"));
                array.Delete(idx);
                aDownload.Delete(); //throw panic
                LOG(_L("delete a download.22222"));            
            }
            break;
        default:
            AppUi()->HandleCommandL(aCommand);
        }
    aDownload.Delete() throw a panic USER 42, why? null pointer?
    i received EHttpDlDeleting event,then throw the panic.

    if i delete it after created immediately,it can success.

    Code:
    void CPMusicDownView::HandleDMgrEventL (RHttpDownload &aDownload, THttpDownloadEvent aEvent)
    {
    	switch(aEvent.iProgressState){
    		default:
    			break;
    	}
    	switch ( aEvent.iDownloadState ) {
    	 case EHttpDlCreated:
    	 {
    		 LOG(_L("Created"));
    		 //CAknQueryDialog* dlg = CAknQueryDialog::NewL();
    		 //if( dlg->ExecuteLD(R_DOWN_CONFIRM_QUERY)==ESoftKeyDownIM){
    		//	 aDownload.Start();
    		// }
    		 aDownload.Delete(); //run OK
    		 break;
    	 }

  2. #2
    Registered User
    Join Date
    Dec 2005
    Posts
    1,236

    Re: How can I delete a RHttpDownload?

    Hi,

    I am not quite sure but are you sure that array.Delete(idx);
    will not delete the item, I guess it is already deleted and you are trying to delete it again because CDownloadArray which is a CArrayPtrFlat which is a derived class of CArrayFixBase and the delete api in it deletes the memory allocated to it you can refer the documentation in the following link http://www.symbian.com/Developer/tec...3aDelete%28%29. In short you need not call aDownload.Delete(). Correct me if I am wrong.

    Regards,
    Sriky
    Last edited by sriky27; 2008-09-13 at 17:24.

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

    Re: How can I delete a RHttpDownload?

    If you get a const array of RXy classes, in general it is not necessarily a wise step removing the const with a const_cast and starting to delete elements.
    In particular USER 42 (you have probably checked in the SDK Help) suggests that those pointers are not allocated in themselves, for example they might come from an array of a more complex class, where RHttpDownload is only a member variable. In that case the address of the RHttpDownload does not point to a valid cell (what USER 42 means), it most probably points to somewhere in the middle of an allocation unit.

  4. #4
    Registered User
    Join Date
    Jul 2003
    Posts
    23

    Re: How can I delete a RHttpDownload?

    Thank you very much.

    But array.Delete(idx) can remove the object from array,and it's no panic.
    Then i restart my application, the aDownload object would be shown again.It will not be truly deleted.

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,750

    Re: How can I delete a RHttpDownload?

    Quote Originally Posted by sharetop View Post
    But array.Delete(idx) can remove the object from array,and it's no panic.
    "array.Delete" does not touch the contained object, only the array.
    Then i restart my application, the aDownload object would be shown again.It will not be truly deleted.
    Yes, that array is created for you when you ask for it, you have no access to the "original", and it may also happen that there is no "original" at all (check my previous post).

  6. #6
    Registered User
    Join Date
    Jul 2003
    Posts
    23

    Re: How can I delete a RHttpDownload?

    Quote Originally Posted by wizard_hu_ View Post
    "array.Delete" does not touch the contained object, only the array.Yes, that array is created for you when you ask for it, you have no access to the "original", and it may also happen that there is no "original" at all (check my previous post).
    Thank you,Then How can I stop/cancel/delete it? I don't hope it be shown in the download list again.

  7. #7
    jp4symbian
    Guest

    Re: How can I delete a RHttpDownload?

    hey folks,

    Has anyone successfully deleted or canceled an RHttpDownload? If yes, please post the solution.
    Thanks.

  8. #8
    Nokia Developer Expert
    Join Date
    Sep 2011
    Posts
    382

    Re: How can I delete a RHttpDownload?

    For an R-class, the release is RHttpDownload::Close() it deletes the transaction same way as reset would do.

    /0

  9. #9
    jp4symbian
    Guest

    Re: How can I delete a RHttpDownload?

    I did try RHttpDownload.Close() for 3rd Edition FP1 & FP2. But it gives link error. Seems the method is missing in the library, is quite strange.

Similar Threads

  1. Delete operator of a custom memory allocator
    By cflaviu in forum Symbian
    Replies: 3
    Last Post: 2008-03-26, 13:49
  2. crash for overloaded delete operator
    By mihirg in forum Symbian
    Replies: 2
    Last Post: 2007-10-09, 12:08
  3. CAppUi Exit() Command Crash
    By mubx2000 in forum Symbian
    Replies: 27
    Last Post: 2007-03-07, 14:06
  4. can not successfully link any sample using .NET
    By lobotomat in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2002-08-20, 00:29
  5. Creating and Delete databases
    By -kevbo- in forum Symbian
    Replies: 1
    Last Post: 2001-12-13, 12: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
  •  
×