Tim Golden wrote:
> I'm using win32gui.PyGetBufferAddressAndLen to pass the address &
> length of a marshalled object as the wparam / lparam of a windows
> message. Something like this:
>
> address, length = \
>  win32gui.PyGetBufferAddressAndLen (buffer (marshal.dumps (message)))
> PostMessage (self.hwnd, self.WM_PROGRESS_MESSAGE, length, address)
>
> where "message" here is actually a unicode object.

But, "marshal.dumps" creates a temporary object, "buffer" creates
another temporary to wrap it, but when that statement ends, both
temporary objects no longer have any references, so they will get
garbage collected.  Won't they?  Now, if you had written it this way:

  hold_me = marshal.dumps( message )
  address, length = win32gui.PyGetBufferAddressandLen( buffer(hold_me) )

then I think it would work, because the marshaled buffer still has a
reference.

-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to