VirtualBox

Changeset 69330 in vbox


Ignore:
Timestamp:
Oct 26, 2017 9:34:35 AM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
118654
Message:

Fixed the bug when ComPtr<Progress> object can stay uninitialized

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/MediumImpl.cpp

    r69322 r69330  
    47694769            /* use the existing progress object... */
    47704770            pProgress = *aProgress;
    4771 
     4771        }
     4772        else
     4773        {
    47724774            /* ...but create a new one if it is null */
    4773             if (pProgress.isNull())
    4774             {
    4775                 pProgress.createObject();
    4776                 rc = pProgress->init(m->pVirtualBox,
    4777                                      static_cast<IMedium*>(this),
    4778                                      BstrFmt(tr("Creating differencing medium storage unit '%s'"),
    4779                                              aTarget->m->strLocationFull.c_str()).raw(),
    4780                                      TRUE /* aCancelable */);
    4781                 if (FAILED(rc))
    4782                     throw rc;
    4783             }
     4775
     4776            pProgress.createObject();
     4777            rc = pProgress->init(m->pVirtualBox,
     4778                                 static_cast<IMedium*>(this),
     4779                                 BstrFmt(tr("Creating differencing medium storage unit '%s'"),
     4780                                         aTarget->m->strLocationFull.c_str()).raw(),
     4781                                 TRUE /* aCancelable */);
     4782            if (FAILED(rc))
     4783                throw rc;
    47844784        }
    47854785
     
    51135113            /* use the existing progress object... */
    51145114            pProgress = *aProgress;
    5115 
     5115        }
     5116        else
     5117        {
    51165118            /* ...but create a new one if it is null */
    51175119            if (pProgress.isNull())
     
    57875789            /* use the existing progress object... */
    57885790            pProgress = *aProgress;
    5789 
     5791        }
     5792        else
     5793        {
    57905794            /* ...but create a new one if it is null */
    5791             if (pProgress.isNull())
    5792             {
    5793                 Utf8Str tgtName;
    5794                 {
    5795                     AutoReadLock alock(pTarget COMMA_LOCKVAL_SRC_POS);
    5796                     tgtName = pTarget->i_getName();
    5797                 }
    5798 
    5799                 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    5800 
    5801                 pProgress.createObject();
    5802                 rc = pProgress->init(m->pVirtualBox,
    5803                                      static_cast<IMedium*>(this),
    5804                                      BstrFmt(tr("Merging medium '%s' to '%s'"),
    5805                                              i_getName().c_str(),
    5806                                              tgtName.c_str()).raw(),
    5807                                      TRUE /* aCancelable */);
    5808                 if (FAILED(rc))
    5809                     throw rc;
    5810             }
     5795            Utf8Str tgtName;
     5796            {
     5797                AutoReadLock alock(pTarget COMMA_LOCKVAL_SRC_POS);
     5798                tgtName = pTarget->i_getName();
     5799            }
     5800
     5801            AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     5802
     5803            pProgress.createObject();
     5804            rc = pProgress->init(m->pVirtualBox,
     5805                                 static_cast<IMedium*>(this),
     5806                                 BstrFmt(tr("Merging medium '%s' to '%s'"),
     5807                                         i_getName().c_str(),
     5808                                         tgtName.c_str()).raw(),
     5809                                 TRUE /* aCancelable */);
     5810            if (FAILED(rc))
     5811                throw rc;
    58115812        }
    58125813
     
    58285829        {
    58295830            rc = pTask->runNow();
    5830 
    58315831            delete pTask;
    58325832        }
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette