| 1587 | //----------------------------------------------------------------------------- |
| 1588 | |
| 1589 | void GuiControl::setControlProfile( GuiControlProfile *prof ) |
| 1590 | { |
| 1591 | AssertFatal( prof, "GuiControl::setControlProfile: invalid profile" ); |
| 1592 | |
| 1593 | if ( prof == mProfile ) |
| 1594 | return; |
| 1595 | |
| 1596 | bool skipAwaken = false; |
| 1597 | |
| 1598 | if ( mProfile == NULL ) |
| 1599 | skipAwaken = true; |
| 1600 | |
| 1601 | if( mProfile ) |
| 1602 | mProfile->decUseCount(); |
| 1603 | |
| 1604 | if ( mAwake && mProfile ) |
| 1605 | mProfile->decLoadCount(); |
| 1606 | |
| 1607 | // Clear the delete notification we previously set up |
| 1608 | if ( mProfile ) |
| 1609 | clearNotify( mProfile ); |
| 1610 | |
| 1611 | mProfile = prof; |
| 1612 | mProfile->incUseCount(); |
| 1613 | if ( mAwake ) |
| 1614 | mProfile->incLoadCount(); |
| 1615 | |
| 1616 | // Make sure that the new profile will notify us when it is deleted |
| 1617 | if ( mProfile ) |
| 1618 | deleteNotify( mProfile ); |
| 1619 | |
| 1620 | // force an update when the profile is changed |
| 1621 | if ( mAwake && !skipAwaken ) |
| 1622 | { |
| 1623 | sleep(); |
| 1624 | |
| 1625 | if( !Sim::isShuttingDown() ) |
| 1626 | awaken(); |
| 1627 | } |
| 1628 | } |
| 1629 | |
| 1630 | //----------------------------------------------------------------------------- |
| 1631 |
no test coverage detected