[Nvda-dev] commit r1950 - trunk/source

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Nvda-dev] commit r1950 - trunk/source

NVDA Subversion
Author: mdcurran
Date: Wed Apr 23 06:29:22 2008
New Revision: 1950

Log:
Make sure to cleanup all virtualBuffers when exiting NVDA. Added virtualBufferHandler.cleanupVirtualBuffers() which kills all running virtualBuffers. Core.main now calls this  function when it terminates all of its other sub systems. I am hoping this should fix some issues where Gecko applications can crash when restarting NVDA while keeping the application open.

Modified:
   trunk/source/core.py
   trunk/source/virtualBufferHandler.py

Modified: trunk/source/core.py
==============================================================================
--- trunk/source/core.py (original)
+++ trunk/source/core.py Wed Apr 23 06:29:22 2008
@@ -159,6 +159,12 @@
  speech.cancelSpeech()
  except:
  pass
+ globalVars.log.debug("Cleaning up running virtualBuffers")
+ try:
+ import virtualBufferHandler
+ virtualBufferHandler.cleanupVirtualBuffers()
+ except:
+ globalVars.log.warn("Error cleaning up virtualBuffers",exc_info=True)
  globalVars.log.debug("Terminating IAccessible support")
  try:
  IAccessibleHandler.terminate()

Modified: trunk/source/virtualBufferHandler.py
==============================================================================
--- trunk/source/virtualBufferHandler.py (original)
+++ trunk/source/virtualBufferHandler.py Wed Apr 23 06:29:22 2008
@@ -73,6 +73,11 @@
  if hasattr(virtualBufferObject,'unloadBuffer'):
  virtualBufferObject.unloadBuffer()
 
+def cleanupVirtualBuffers():
+ """Kills any currently running virtualBuffers"""
+ for v in list(runningTable):
+ killVirtualBuffer(v)
+
 def reportPassThrough(virtualBuffer):
  """Speaks the state of virtualBufferPassThroughMode if it has changed.
  @param virtualBuffer: The current virtual buffer.


Reply | Threaded
Open this post in threaded view
|

Re: [Nvda-dev] commit r1950 - trunk/source

James Teh-2
Would there be any harm in having a __del__ method on VirtualBuffer
objects to kill them? This seems the more Pythonic way to do things. I
don't *think* this should cause any circular reference style memory
leaks, as I'm pretty sure there are no references from virtual buffers
to themselves, directly or indirectly...

Jamie


NVDA Subversion wrote:
> Author: mdcurran
> Date: Wed Apr 23 06:29:22 2008
> New Revision: 1950
>
> Log:
> Make sure to cleanup all virtualBuffers when exiting NVDA. Added virtualBufferHandler.cleanupVirtualBuffers() which kills all running virtualBuffers. Core.main now calls this  function when it terminates all of its other sub systems. I am hoping this should fix some issues where Gecko applications can crash when restarting NVDA while keeping the application open.

--
James Teh
Email: [hidden email]
WWW: http://www.jantrid.net/
MSN Messenger: [hidden email]
Jabber: [hidden email]
Yahoo: jcs_teh


Reply | Threaded
Open this post in threaded view
|

Re: [Nvda-dev] commit r1950 - trunk/source

Michael Curran
Hi,

Perhaps that might be ok. Though I'm sure I have seen cases where
removing a virtualBuffer from runningTable, it seemed to stay around for
some reason. Though, I guess for NVDA to actually exit, *all* must be
deleted? or is it possible for Python to exit with objects not distructed?

If it definitely works and __del__ will be called I'm happy to do it.
But this way its clear that it will happen, cause it has a place in core.

Mick


James Teh wrote:

> Would there be any harm in having a __del__ method on VirtualBuffer
> objects to kill them? This seems the more Pythonic way to do things. I
> don't *think* this should cause any circular reference style memory
> leaks, as I'm pretty sure there are no references from virtual buffers
> to themselves, directly or indirectly...
>
> Jamie
>
>
> NVDA Subversion wrote:
>> Author: mdcurran
>> Date: Wed Apr 23 06:29:22 2008
>> New Revision: 1950
>>
>> Log:
>> Make sure to cleanup all virtualBuffers when exiting NVDA. Added virtualBufferHandler.cleanupVirtualBuffers() which kills all running virtualBuffers. Core.main now calls this  function when it terminates all of its other sub systems. I am hoping this should fix some issues where Gecko applications can crash when restarting NVDA while keeping the application open.
>


Reply | Threaded
Open this post in threaded view
|

Re: [Nvda-dev] commit r1950 - trunk/source

James Teh-2
Hi.
It should not be possible for Python to exit without objects destructed
under normal circumstances, although I'm not sure what happens if there
is some sort of circular reference which prevents garbage collection. I
can't see this being an issue here, though.

Note that __del__ should not try to call killVirtualBuffer, because this
will mutate the list. If __del__ gets called, the buffer has already
been removed from the list, so __del__ just needs to call unloadBuffer.

Jamie

Michael Curran wrote:
> Perhaps that might be ok. Though I'm sure I have seen cases where
> removing a virtualBuffer from runningTable, it seemed to stay around for
> some reason. Though, I guess for NVDA to actually exit, *all* must be
> deleted? or is it possible for Python to exit with objects not distructed?
>
> If it definitely works and __del__ will be called I'm happy to do it.
> But this way its clear that it will happen, cause it has a place in core.
>
> Mick

--
James Teh
Email: [hidden email]
WWW: http://www.jantrid.net/
MSN Messenger: [hidden email]
Jabber: [hidden email]
Yahoo: jcs_teh