Rename 'destroy' methods to 'dealloc'

Removes confusion with QWidget::destroy, which is not virtual and thus
is never dispatched into Python code.
This commit is contained in:
David Vierra 2016-01-30 15:10:43 -10:00
parent f5238b9941
commit b6d372e97e
6 changed files with 20 additions and 20 deletions

View File

@ -644,7 +644,7 @@ class MCEditApp(QtGui.QApplication):
self.removeSessionDockWidgets()
self.undoGroup.removeStack(session.undoStack)
self.sessions.remove(session)
session.destroy()
session.dealloc()
gc.collect()
else:
self.tabWidget.removeTab(index)

View File

@ -490,10 +490,10 @@ class EditorSession(QtCore.QObject):
if hasattr(progress, 'progressCount') and progress.progressCount != progressMax:
log.info("Update progressMax to %d, please.", progress.progressCount)
def destroy(self):
def dealloc(self):
self.worldEditor.close()
self.worldEditor = None
self.editorTab.destroy()
self.editorTab.dealloc()
# Break all reference cycles just to be absolutely sure.
self.__dict__.clear()
@ -1318,12 +1318,12 @@ class EditorTab(QtGui.QWidget):
spacer.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.viewButtonToolbar.addWidget(spacer)
def destroy(self, *a, **kw):
def dealloc(self, *a, **kw):
self.editorSession = None
for view in self.views:
view.destroy()
view.dealloc()
super(EditorTab, self).destroy(*a, **kw)
super(EditorTab, self).dealloc(*a, **kw)
def setDayTime(self, value):
if self.editorSession.textureAtlas:

View File

@ -141,10 +141,10 @@ class RenderNode(object):
def drawSelf(self):
pass
def destroy(self):
def dealloc(self):
for child in self.children:
child.destroy()
self.displayList.destroy()
child.dealloc()
self.displayList.dealloc()
"""
UNUSED??
@ -238,7 +238,7 @@ def updateChildren(renderNode):
for node in orphans:
renderNode.removeChild(node)
node.destroy()
node.dealloc()
# Find sceneNode children who do not have a renderNode as a child of this renderNode
for index, sceneChild in enumerate(sceneNode.children):

View File

@ -36,7 +36,7 @@ log = logging.getLogger(__name__)
class gl(object):
@classmethod
def ResetGL(cls):
DisplayList.destroyAllLists()
DisplayList.deallocAllLists()
@classmethod
@contextmanager
@ -120,12 +120,12 @@ class DisplayList(object):
allDisplayLists.append(weakref.ref(self, _delete))
@classmethod
def destroyAllLists(self):
def deallocAllLists(self):
allLists = []
for listref in allDisplayLists:
list = listref()
if list:
list.destroy()
list.dealloc()
allLists.append(listref)
allDisplayLists[:] = allLists
@ -133,7 +133,7 @@ class DisplayList(object):
def invalidate(self):
self.dirty = True
def destroy(self):
def dealloc(self):
if self._list is not None:
GL.glDeleteLists(self._list, 1)
self._list = None

View File

@ -394,7 +394,7 @@ class WorldListWidget(QtGui.QDialog, Ui_worldList):
QtGui.qApp.processEvents() # force repaint of stackedWidget to hide old error widget
if self.worldView:
log.info("Removing view from WorldListWidget")
self.worldView.destroy()
self.worldView.dealloc()
self.stackedWidget.removeWidget(self.worldView)
self.worldView.setParent(None)
self.worldView = None

View File

@ -188,11 +188,11 @@ class WorldView(QGLWidget):
self.setDimension(dimension)
def destroy(self, *a, **kw):
self.makeCurrent()
self.renderGraph.destroy()
def dealloc(self):
log.info("Deallocating GL resources for worldview %s", self)
self.bufferSwapThread.quit()
super(WorldView, self).destroy(*a, **kw)
self.makeCurrent()
self.renderGraph.dealloc()
def __str__(self):
try:
@ -218,7 +218,7 @@ class WorldView(QGLWidget):
self.dimension = dimension
self.makeCurrent()
if self.renderGraph:
self.renderGraph.destroy()
self.renderGraph.dealloc()
self.sceneGraph = self.createSceneGraph()
self.renderGraph = rendernode.createRenderNode(self.sceneGraph)
self.resetLoadOrder()