| 1854 | //----------------------------------------------------------------------------- |
| 1855 | |
| 1856 | void SimObject::unlinkNamespaces() |
| 1857 | { |
| 1858 | if( !mNameSpace ) |
| 1859 | return; |
| 1860 | |
| 1861 | Namespace* cppNamespace = getClassRep()->getNameSpace(); |
| 1862 | Namespace* parentNamespace = cppNamespace; |
| 1863 | |
| 1864 | // Handle superclass. |
| 1865 | |
| 1866 | if( mSuperClassName && mSuperClassName[ 0 ] ) |
| 1867 | { |
| 1868 | // Get the superclass namespace. |
| 1869 | |
| 1870 | Namespace* superClassNamespace = Con::lookupNamespace( mSuperClassName ); |
| 1871 | |
| 1872 | // Make it the parent namespace. |
| 1873 | |
| 1874 | parentNamespace = superClassNamespace; |
| 1875 | |
| 1876 | // Decrease parent refcounts on the superclass hierarchy. |
| 1877 | |
| 1878 | for( Namespace* linkWalk = superClassNamespace; |
| 1879 | linkWalk != NULL && linkWalk != cppNamespace && linkWalk->getParent() != NULL; ) |
| 1880 | { |
| 1881 | // Store the parent link since it may disappear once we |
| 1882 | // decrease the reference count. |
| 1883 | Namespace* parent = linkWalk->getParent(); |
| 1884 | |
| 1885 | // Decrease the refcount. |
| 1886 | if( linkWalk->getPackage() == NULL ) // Skip namespaces coming from packages. |
| 1887 | linkWalk->decRefCountToParent(); |
| 1888 | |
| 1889 | // Walk up. |
| 1890 | linkWalk = parent; |
| 1891 | } |
| 1892 | } |
| 1893 | |
| 1894 | // Handle class. |
| 1895 | |
| 1896 | if( mClassName && mClassName[ 0 ] ) |
| 1897 | { |
| 1898 | Namespace* classNamespace = Con::lookupNamespace( mClassName ); |
| 1899 | if( classNamespace ) |
| 1900 | { |
| 1901 | classNamespace->decRefCountToParent(); |
| 1902 | parentNamespace = classNamespace; |
| 1903 | } |
| 1904 | } |
| 1905 | |
| 1906 | // Handle object name. |
| 1907 | |
| 1908 | StringTableEntry objectName = getName(); |
| 1909 | if( objectName && objectName[ 0 ] ) |
| 1910 | mNameSpace->decRefCountToParent(); |
| 1911 | |
| 1912 | mNameSpace = NULL; |
| 1913 | } |
nothing calls this directly
no test coverage detected