I'm doing preliminary tests with the "close" method in order to support
multiple Leo files in leoInteg.
def closeFile(self, p_paramUnused):
'''Closes a leo file. A file can then be opened with "openFile"'''
print("Trying to close opened file " + str(self.commander.changed))
if self.commander:
if self.commander.changed:
return self.sendLeoBridgePackage('closed', False)
else:
self.commander.close()
return self.sendLeoBridgePackage('closed', True)
return self.sendLeoBridgePackage() # Just send empty as 'did nothing'
After going through the second branch and actually calling the .close()
method on the controller that was made with the leoBridge, since I didnt
change anything else to support a 'closed' commander, I expected the
leoInteg view to fatally crash because all subsequent calls to
'getChildren' etc. would obviously fail because the commander was closed.
Surprising thing is : There is no crash and I can seemingly do any browsing
and editing as I could before the .close() call...
I suspect it's me who's not understanding what the self.commander.close
method is actually expected to do, or maybe I should be calling something
like "self.commander.file.close()" or something like that... Or maybe that
just lowered an "opened" flag somewhere and all objects are still valid
pointers until python does garbage collecting... i dunno :/
If anyone can shed some light on this it would be greatly appreciated! :)
--
Félix
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/leo-editor/7fb96f04-c216-4c5b-b14f-85cbe3f4d6c5o%40googlegroups.com.