| 1572 | //----------------------------------------------------------------------------- |
| 1573 | |
| 1574 | void GuiControl::setControlProfile( GuiControlProfile *prof ) |
| 1575 | { |
| 1576 | AssertFatal( prof, "GuiControl::setControlProfile: invalid profile" ); |
| 1577 | |
| 1578 | if ( prof == mProfile ) |
| 1579 | return; |
| 1580 | |
| 1581 | bool skipAwaken = false; |
| 1582 | |
| 1583 | if ( mProfile == NULL ) |
| 1584 | skipAwaken = true; |
| 1585 | |
| 1586 | if( mProfile ) |
| 1587 | mProfile->decUseCount(); |
| 1588 | |
| 1589 | if ( mAwake && mProfile ) |
| 1590 | mProfile->decLoadCount(); |
| 1591 | |
| 1592 | // Clear the delete notification we previously set up |
| 1593 | if ( mProfile ) |
| 1594 | clearNotify( mProfile ); |
| 1595 | |
| 1596 | mProfile = prof; |
| 1597 | mProfile->incUseCount(); |
| 1598 | if ( mAwake ) |
| 1599 | mProfile->incLoadCount(); |
| 1600 | |
| 1601 | // Make sure that the new profile will notify us when it is deleted |
| 1602 | if ( mProfile ) |
| 1603 | deleteNotify( mProfile ); |
| 1604 | |
| 1605 | // force an update when the profile is changed |
| 1606 | if ( mAwake && !skipAwaken ) |
| 1607 | { |
| 1608 | sleep(); |
| 1609 | |
| 1610 | if( !Sim::isShuttingDown() ) |
| 1611 | awaken(); |
| 1612 | } |
| 1613 | } |
| 1614 | |
| 1615 | //----------------------------------------------------------------------------- |
| 1616 |
no test coverage detected