- Fix bug in CSceneNodeAnimatorCollisionResponse::setWorld as found by Quillraven.
- Fix simliar bugs where object have been dropped accidentally in set functions in many places git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2417 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
parent
f598ea9265
commit
2391338b57
@ -305,6 +305,8 @@ void CGUIButton::setOverrideFont(IGUIFont* font)
|
|||||||
//! Sets an image which should be displayed on the button when it is in normal state.
|
//! Sets an image which should be displayed on the button when it is in normal state.
|
||||||
void CGUIButton::setImage(video::ITexture* image)
|
void CGUIButton::setImage(video::ITexture* image)
|
||||||
{
|
{
|
||||||
|
if (image)
|
||||||
|
image->grab();
|
||||||
if (Image)
|
if (Image)
|
||||||
Image->drop();
|
Image->drop();
|
||||||
|
|
||||||
@ -315,9 +317,6 @@ void CGUIButton::setImage(video::ITexture* image)
|
|||||||
ImageRect = core::rect<s32>(core::position2d<s32>(0,0), signedSize);
|
ImageRect = core::rect<s32>(core::position2d<s32>(0,0), signedSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Image)
|
|
||||||
Image->grab();
|
|
||||||
|
|
||||||
if (!PressedImage)
|
if (!PressedImage)
|
||||||
setPressedImage(Image);
|
setPressedImage(Image);
|
||||||
}
|
}
|
||||||
@ -326,15 +325,14 @@ void CGUIButton::setImage(video::ITexture* image)
|
|||||||
//! Sets the image which should be displayed on the button when it is in its normal state.
|
//! Sets the image which should be displayed on the button when it is in its normal state.
|
||||||
void CGUIButton::setImage(video::ITexture* image, const core::rect<s32>& pos)
|
void CGUIButton::setImage(video::ITexture* image, const core::rect<s32>& pos)
|
||||||
{
|
{
|
||||||
|
if (image)
|
||||||
|
image->grab();
|
||||||
if (Image)
|
if (Image)
|
||||||
Image->drop();
|
Image->drop();
|
||||||
|
|
||||||
Image = image;
|
Image = image;
|
||||||
ImageRect = pos;
|
ImageRect = pos;
|
||||||
|
|
||||||
if (Image)
|
|
||||||
Image->grab();
|
|
||||||
|
|
||||||
if (!PressedImage)
|
if (!PressedImage)
|
||||||
setPressedImage(Image, pos);
|
setPressedImage(Image, pos);
|
||||||
}
|
}
|
||||||
@ -343,6 +341,9 @@ void CGUIButton::setImage(video::ITexture* image, const core::rect<s32>& pos)
|
|||||||
//! Sets an image which should be displayed on the button when it is in pressed state.
|
//! Sets an image which should be displayed on the button when it is in pressed state.
|
||||||
void CGUIButton::setPressedImage(video::ITexture* image)
|
void CGUIButton::setPressedImage(video::ITexture* image)
|
||||||
{
|
{
|
||||||
|
if (image)
|
||||||
|
image->grab();
|
||||||
|
|
||||||
if (PressedImage)
|
if (PressedImage)
|
||||||
PressedImage->drop();
|
PressedImage->drop();
|
||||||
|
|
||||||
@ -352,23 +353,19 @@ void CGUIButton::setPressedImage(video::ITexture* image)
|
|||||||
core::dimension2di signedSize(image->getOriginalSize());
|
core::dimension2di signedSize(image->getOriginalSize());
|
||||||
PressedImageRect = core::rect<s32>(core::position2d<s32>(0,0), signedSize);
|
PressedImageRect = core::rect<s32>(core::position2d<s32>(0,0), signedSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PressedImage)
|
|
||||||
PressedImage->grab();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Sets the image which should be displayed on the button when it is in its pressed state.
|
//! Sets the image which should be displayed on the button when it is in its pressed state.
|
||||||
void CGUIButton::setPressedImage(video::ITexture* image, const core::rect<s32>& pos)
|
void CGUIButton::setPressedImage(video::ITexture* image, const core::rect<s32>& pos)
|
||||||
{
|
{
|
||||||
|
if (image)
|
||||||
|
image->grab();
|
||||||
if (PressedImage)
|
if (PressedImage)
|
||||||
PressedImage->drop();
|
PressedImage->drop();
|
||||||
|
|
||||||
PressedImage = image;
|
PressedImage = image;
|
||||||
PressedImageRect = pos;
|
PressedImageRect = pos;
|
||||||
|
|
||||||
if (PressedImage)
|
|
||||||
PressedImage->grab();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,6 +90,8 @@ void CGUIContextMenu::setSubMenu(u32 index, CGUIContextMenu* menu)
|
|||||||
if (index >= Items.size())
|
if (index >= Items.size())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (menu)
|
||||||
|
menu->grab();
|
||||||
if (Items[index].SubMenu)
|
if (Items[index].SubMenu)
|
||||||
Items[index].SubMenu->drop();
|
Items[index].SubMenu->drop();
|
||||||
|
|
||||||
@ -98,7 +100,6 @@ void CGUIContextMenu::setSubMenu(u32 index, CGUIContextMenu* menu)
|
|||||||
|
|
||||||
if (Items[index].SubMenu)
|
if (Items[index].SubMenu)
|
||||||
{
|
{
|
||||||
menu->grab();
|
|
||||||
menu->AllowFocus = false;
|
menu->AllowFocus = false;
|
||||||
if ( Environment->getFocus() == menu )
|
if ( Environment->getFocus() == menu )
|
||||||
{
|
{
|
||||||
|
@ -597,6 +597,8 @@ u32 CGUIListBox::addItem(const wchar_t* text, s32 icon)
|
|||||||
|
|
||||||
void CGUIListBox::setSpriteBank(IGUISpriteBank* bank)
|
void CGUIListBox::setSpriteBank(IGUISpriteBank* bank)
|
||||||
{
|
{
|
||||||
|
if ( bank == IconBank )
|
||||||
|
return;
|
||||||
if (IconBank)
|
if (IconBank)
|
||||||
IconBank->drop();
|
IconBank->drop();
|
||||||
|
|
||||||
|
@ -40,14 +40,12 @@ CGUIMeshViewer::~CGUIMeshViewer()
|
|||||||
//! sets the mesh to be shown
|
//! sets the mesh to be shown
|
||||||
void CGUIMeshViewer::setMesh(scene::IAnimatedMesh* mesh)
|
void CGUIMeshViewer::setMesh(scene::IAnimatedMesh* mesh)
|
||||||
{
|
{
|
||||||
|
if (mesh)
|
||||||
|
mesh->grab();
|
||||||
if (Mesh)
|
if (Mesh)
|
||||||
Mesh->drop();
|
Mesh->drop();
|
||||||
|
|
||||||
Mesh = mesh;
|
Mesh = mesh;
|
||||||
if (!Mesh)
|
|
||||||
return;
|
|
||||||
else
|
|
||||||
Mesh->grab();
|
|
||||||
|
|
||||||
/* This might be used for proper transformation etc.
|
/* This might be used for proper transformation etc.
|
||||||
core::vector3df center(0.0f,0.0f,0.0f);
|
core::vector3df center(0.0f,0.0f,0.0f);
|
||||||
|
@ -205,13 +205,12 @@ void CGUISkin::setFont(IGUIFont* font, EGUI_DEFAULT_FONT which)
|
|||||||
if ((u32)which >= EGDS_COUNT)
|
if ((u32)which >= EGDS_COUNT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (font)
|
||||||
|
font->grab();
|
||||||
if (Fonts[which])
|
if (Fonts[which])
|
||||||
Fonts[which]->drop();
|
Fonts[which]->drop();
|
||||||
|
|
||||||
Fonts[which] = font;
|
Fonts[which] = font;
|
||||||
|
|
||||||
if (Fonts[which])
|
|
||||||
Fonts[which]->grab();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -225,12 +224,12 @@ IGUISpriteBank* CGUISkin::getSpriteBank() const
|
|||||||
//! set a new sprite bank or remove one by passing 0
|
//! set a new sprite bank or remove one by passing 0
|
||||||
void CGUISkin::setSpriteBank(IGUISpriteBank* bank)
|
void CGUISkin::setSpriteBank(IGUISpriteBank* bank)
|
||||||
{
|
{
|
||||||
if (SpriteBank)
|
|
||||||
SpriteBank->drop();
|
|
||||||
|
|
||||||
if (bank)
|
if (bank)
|
||||||
bank->grab();
|
bank->grab();
|
||||||
|
|
||||||
|
if (SpriteBank)
|
||||||
|
SpriteBank->drop();
|
||||||
|
|
||||||
SpriteBank = bank;
|
SpriteBank = bank;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,12 +80,12 @@ void CGUISpriteBank::setTexture(u32 index, video::ITexture* texture)
|
|||||||
while (index >= Textures.size())
|
while (index >= Textures.size())
|
||||||
Textures.push_back(0);
|
Textures.push_back(0);
|
||||||
|
|
||||||
if (Textures[index])
|
|
||||||
Textures[index]->drop();
|
|
||||||
|
|
||||||
if (texture)
|
if (texture)
|
||||||
texture->grab();
|
texture->grab();
|
||||||
|
|
||||||
|
if (Textures[index])
|
||||||
|
Textures[index]->drop();
|
||||||
|
|
||||||
Textures[index] = texture;
|
Textures[index] = texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1046,6 +1046,8 @@ void CGUITreeView::setIconFont( IGUIFont* font )
|
|||||||
{
|
{
|
||||||
s32 height;
|
s32 height;
|
||||||
|
|
||||||
|
if ( font )
|
||||||
|
font->grab();
|
||||||
if ( IconFont )
|
if ( IconFont )
|
||||||
{
|
{
|
||||||
IconFont->drop();
|
IconFont->drop();
|
||||||
@ -1059,7 +1061,6 @@ void CGUITreeView::setIconFont( IGUIFont* font )
|
|||||||
{
|
{
|
||||||
ItemHeight = height;
|
ItemHeight = height;
|
||||||
}
|
}
|
||||||
IconFont->grab();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1067,6 +1068,8 @@ void CGUITreeView::setIconFont( IGUIFont* font )
|
|||||||
//! The default is 0 (no images).
|
//! The default is 0 (no images).
|
||||||
void CGUITreeView::setImageList( IGUIImageList* imageList )
|
void CGUITreeView::setImageList( IGUIImageList* imageList )
|
||||||
{
|
{
|
||||||
|
if (imageList )
|
||||||
|
imageList->grab();
|
||||||
if( ImageList )
|
if( ImageList )
|
||||||
{
|
{
|
||||||
ImageList->drop();
|
ImageList->drop();
|
||||||
@ -1079,7 +1082,6 @@ void CGUITreeView::setImageList( IGUIImageList* imageList )
|
|||||||
{
|
{
|
||||||
ItemHeight = ImageList->getImageSize().Height + 1;
|
ItemHeight = ImageList->getImageSize().Height + 1;
|
||||||
}
|
}
|
||||||
ImageList->grab();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,13 +228,12 @@ IOSOperator* CIrrDeviceStub::getOSOperator()
|
|||||||
//! Sets the input receiving scene manager.
|
//! Sets the input receiving scene manager.
|
||||||
void CIrrDeviceStub::setInputReceivingSceneManager(scene::ISceneManager* sceneManager)
|
void CIrrDeviceStub::setInputReceivingSceneManager(scene::ISceneManager* sceneManager)
|
||||||
{
|
{
|
||||||
|
if (sceneManager)
|
||||||
|
sceneManager->grab();
|
||||||
if (InputReceivingSceneManager)
|
if (InputReceivingSceneManager)
|
||||||
InputReceivingSceneManager->drop();
|
InputReceivingSceneManager->drop();
|
||||||
|
|
||||||
InputReceivingSceneManager = sceneManager;
|
InputReceivingSceneManager = sceneManager;
|
||||||
|
|
||||||
if (InputReceivingSceneManager)
|
|
||||||
InputReceivingSceneManager->grab();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -295,14 +295,12 @@ void CMeshSceneNode::setMesh(IMesh* mesh)
|
|||||||
if (!mesh)
|
if (!mesh)
|
||||||
return; // won't set null mesh
|
return; // won't set null mesh
|
||||||
|
|
||||||
|
mesh->grab();
|
||||||
if (Mesh)
|
if (Mesh)
|
||||||
Mesh->drop();
|
Mesh->drop();
|
||||||
|
|
||||||
Mesh = mesh;
|
Mesh = mesh;
|
||||||
copyMaterials();
|
copyMaterials();
|
||||||
|
|
||||||
if (Mesh)
|
|
||||||
Mesh->grab();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -286,10 +286,10 @@ bool COctTreeSceneNode::createTree(IMesh* mesh)
|
|||||||
|
|
||||||
MeshName = SceneManager->getMeshCache()->getMeshFilename( mesh );
|
MeshName = SceneManager->getMeshCache()->getMeshFilename( mesh );
|
||||||
|
|
||||||
|
mesh->grab();
|
||||||
deleteTree();
|
deleteTree();
|
||||||
|
|
||||||
Mesh = mesh;
|
Mesh = mesh;
|
||||||
Mesh->grab();
|
|
||||||
|
|
||||||
u32 beginTime = os::Timer::getRealTime();
|
u32 beginTime = os::Timer::getRealTime();
|
||||||
|
|
||||||
|
@ -72,6 +72,8 @@ IParticleEmitter* CParticleSystemSceneNode::getEmitter()
|
|||||||
//! Sets the particle emitter, which creates the particles.
|
//! Sets the particle emitter, which creates the particles.
|
||||||
void CParticleSystemSceneNode::setEmitter(IParticleEmitter* emitter)
|
void CParticleSystemSceneNode::setEmitter(IParticleEmitter* emitter)
|
||||||
{
|
{
|
||||||
|
if (emitter == Emitter)
|
||||||
|
return;
|
||||||
if (Emitter)
|
if (Emitter)
|
||||||
Emitter->drop();
|
Emitter->drop();
|
||||||
|
|
||||||
|
@ -1095,13 +1095,12 @@ ICameraSceneNode* CSceneManager::getActiveCamera() const
|
|||||||
//! \param camera: The new camera which should be active.
|
//! \param camera: The new camera which should be active.
|
||||||
void CSceneManager::setActiveCamera(ICameraSceneNode* camera)
|
void CSceneManager::setActiveCamera(ICameraSceneNode* camera)
|
||||||
{
|
{
|
||||||
|
if (camera)
|
||||||
|
camera->grab();
|
||||||
if (ActiveCamera)
|
if (ActiveCamera)
|
||||||
ActiveCamera->drop();
|
ActiveCamera->drop();
|
||||||
|
|
||||||
ActiveCamera = camera;
|
ActiveCamera = camera;
|
||||||
|
|
||||||
if (ActiveCamera)
|
|
||||||
ActiveCamera->grab();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1579,13 +1578,12 @@ void CSceneManager::drawAll()
|
|||||||
|
|
||||||
void CSceneManager::setLightManager(ILightManager* lightManager)
|
void CSceneManager::setLightManager(ILightManager* lightManager)
|
||||||
{
|
{
|
||||||
|
if ( lightManager )
|
||||||
|
lightManager->grab();
|
||||||
if(LightManager)
|
if(LightManager)
|
||||||
LightManager->drop();
|
LightManager->drop();
|
||||||
|
|
||||||
LightManager = lightManager;
|
LightManager = lightManager;
|
||||||
|
|
||||||
if(LightManager)
|
|
||||||
LightManager->grab();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -118,15 +118,15 @@ core::vector3df CSceneNodeAnimatorCollisionResponse::getEllipsoidTranslation() c
|
|||||||
//! the scene node may collide.
|
//! the scene node may collide.
|
||||||
void CSceneNodeAnimatorCollisionResponse::setWorld(ITriangleSelector* newWorld)
|
void CSceneNodeAnimatorCollisionResponse::setWorld(ITriangleSelector* newWorld)
|
||||||
{
|
{
|
||||||
|
if (newWorld)
|
||||||
|
newWorld->grab();
|
||||||
|
|
||||||
if (World)
|
if (World)
|
||||||
World->drop();
|
World->drop();
|
||||||
|
|
||||||
World = newWorld;
|
World = newWorld;
|
||||||
if (World)
|
|
||||||
World->grab();
|
|
||||||
|
|
||||||
FirstUpdate = true;
|
FirstUpdate = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -273,6 +273,9 @@ ISceneNodeAnimator* CSceneNodeAnimatorCollisionResponse::createClone(ISceneNode*
|
|||||||
|
|
||||||
void CSceneNodeAnimatorCollisionResponse::setCollisionCallback(ICollisionCallback* callback)
|
void CSceneNodeAnimatorCollisionResponse::setCollisionCallback(ICollisionCallback* callback)
|
||||||
{
|
{
|
||||||
|
if ( CollisionCallback == callback )
|
||||||
|
return;
|
||||||
|
|
||||||
if (CollisionCallback)
|
if (CollisionCallback)
|
||||||
CollisionCallback->drop();
|
CollisionCallback->drop();
|
||||||
|
|
||||||
|
@ -253,6 +253,8 @@ void CShadowVolumeSceneNode::createZPassVolume(s32 faceCount,
|
|||||||
|
|
||||||
void CShadowVolumeSceneNode::setShadowMesh(const IMesh* mesh)
|
void CShadowVolumeSceneNode::setShadowMesh(const IMesh* mesh)
|
||||||
{
|
{
|
||||||
|
if ( ShadowMesh == mesh )
|
||||||
|
return;
|
||||||
if (ShadowMesh)
|
if (ShadowMesh)
|
||||||
ShadowMesh->drop();
|
ShadowMesh->drop();
|
||||||
ShadowMesh = mesh;
|
ShadowMesh = mesh;
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
Test suite pass at GMT Tue Jun 9 00:45:13 2009
|
Test suite pass at GMT Wed Jun 10 20:04:22 2009
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user