gui/applets: properly destroy container widget when process is terminated

This commit is contained in:
Sebastien Bourdeauducq 2016-02-11 16:02:10 +01:00
parent c9a9d19182
commit cd9467a8df
1 changed files with 5 additions and 2 deletions

View File

@ -114,8 +114,8 @@ class AppletDock(dockarea.Dock):
def embed(self, win_id): def embed(self, win_id):
logger.debug("capturing window 0x%x for %s", win_id, self.applet_name) logger.debug("capturing window 0x%x for %s", win_id, self.applet_name)
embed_window = QtGui.QWindow.fromWinId(win_id) embed_window = QtGui.QWindow.fromWinId(win_id)
embed_widget = QtWidgets.QWidget.createWindowContainer(embed_window) self.embed_widget = QtWidgets.QWidget.createWindowContainer(embed_window)
self.addWidget(embed_widget) self.addWidget(self.embed_widget)
async def terminate(self): async def terminate(self):
if hasattr(self, "ipc"): if hasattr(self, "ipc"):
@ -133,6 +133,9 @@ class AppletDock(dockarea.Dock):
await self.ipc.process.wait() await self.ipc.process.wait()
del self.ipc del self.ipc
self.embed_widget.deleteLater()
del self.embed_widget
async def restart(self): async def restart(self):
await self.terminate() await self.terminate()
await self.start() await self.start()