2008-01-06, 01:32 AM
Sub-
Couple questions about memory management:
1) What is the difference between skinHelper2.DisposeResources()
and PluginHelperFactory.getPluginHelper().DisposeResources(disposeList) ?
Should both be called in the Dispose method of each control instance?
2) Should the control's Dispose() call element.image.Dispose(), or does the call to the PluginHelper.DisposeResources do that under the covers. (see example below)
3) It looks like the UiButton.Dispose() method is empty. Shouldn't it call the PluginHelper dispose with the normal and selected UIElements?
Currently all the WizControls call the xxx.image.Dispose() method for each GBPVRUiElement object in the control as well as calling the PluginHelper dispose method at the end of the controls Dispose() routine.
For example, here is the dispose method for the text box:
Is that the proper way to dispose of the objects?
Couple questions about memory management:
1) What is the difference between skinHelper2.DisposeResources()
and PluginHelperFactory.getPluginHelper().DisposeResources(disposeList) ?
Should both be called in the Dispose method of each control instance?
2) Should the control's Dispose() call element.image.Dispose(), or does the call to the PluginHelper.DisposeResources do that under the covers. (see example below)
3) It looks like the UiButton.Dispose() method is empty. Shouldn't it call the PluginHelper dispose with the normal and selected UIElements?
Currently all the WizControls call the xxx.image.Dispose() method for each GBPVRUiElement object in the control as well as calling the PluginHelper dispose method at the end of the controls Dispose() routine.
For example, here is the dispose method for the text box:
Code:
[COLOR=black][SIZE=2]public [/SIZE][SIZE=2]override [/SIZE][SIZE=2]void[/SIZE][SIZE=2] Dispose()[/SIZE][/COLOR]
[SIZE=2][COLOR=black]{[/COLOR][/SIZE]
[SIZE=2][COLOR=black] WizInfo.LogMessage("WizUiTextBox", "Dispose()", "Called for " + this.PlacementName);[/COLOR][/SIZE]
[COLOR=black][SIZE=2] mRenderingRequired = [/SIZE][SIZE=2]false[/SIZE][SIZE=2];[/SIZE][/COLOR]
[COLOR=black][SIZE=2] ArrayList[/SIZE][SIZE=2] disposeList = [/SIZE][SIZE=2]new[/SIZE][SIZE=2]ArrayList[/SIZE][SIZE=2]();[/SIZE][/COLOR]
[COLOR=black][SIZE=2] if[/SIZE][SIZE=2] ([/SIZE][SIZE=2]this[/SIZE][SIZE=2].normalUiElement != [/SIZE][SIZE=2]null[/SIZE][SIZE=2])[/SIZE][/COLOR]
[COLOR=black][SIZE=2] this[/SIZE][SIZE=2].normalUiElement.image.Dispose();[/SIZE][SIZE=2] disposeList.Add([/SIZE][SIZE=2]this[/SIZE][SIZE=2].normalUiElement);[/SIZE][/COLOR]
[COLOR=black][SIZE=2] if[/SIZE][SIZE=2] ([/SIZE][SIZE=2]this[/SIZE][SIZE=2].selectedUiElement != [/SIZE][SIZE=2]null[/SIZE][SIZE=2])[/SIZE][/COLOR]
[SIZE=2][COLOR=black] {[/COLOR][/SIZE]
[COLOR=black][SIZE=2] this[/SIZE][SIZE=2].selectedUiElement.image.Dispose();[/SIZE][/COLOR]
[COLOR=black][SIZE=2] disposeList.Add([/SIZE][SIZE=2]this[/SIZE][SIZE=2].selectedUiElement);[/SIZE][/COLOR]
[SIZE=2][COLOR=black] }[/COLOR][/SIZE]
[COLOR=black][SIZE=2] PluginHelperFactory[/SIZE][SIZE=2].getPluginHelper().DisposeResources(disposeList);[/SIZE][/COLOR]
[COLOR=black][SIZE=2] normalUiElement = [/SIZE][SIZE=2]null[/SIZE][SIZE=2];[/SIZE][/COLOR]
[COLOR=black][SIZE=2] selectedUiElement = [/SIZE][SIZE=2]null[/SIZE][SIZE=2];[/SIZE][/COLOR]
[SIZE=2][COLOR=black]}[/COLOR][/SIZE]