Update of /cvsroot/pywin32/pywin32/Pythonwin
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv12579
Modified Files:
Tag: py3k
win32assoc.cpp win32assoc.h win32cmd.cpp win32cmd.h
win32dlg.cpp win32dlg.h win32gdi.cpp win32hl.h win32prop.h
win32win.cpp
Log Message:
remove DoKillAssoc and 3rd param to Assoc()
Index: win32assoc.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32assoc.cpp,v
retrieving revision 1.9.2.3
retrieving revision 1.9.2.4
diff -C2 -d -r1.9.2.3 -r1.9.2.4
*** win32assoc.cpp 28 Dec 2008 10:55:48 -0000 1.9.2.3
--- win32assoc.cpp 28 Dec 2008 12:53:32 -0000 1.9.2.4
***************
*** 77,111 ****
}
! void CAssocManager::Assoc(void *handle, ui_assoc_object *object, void *oldHandle)
{
m_critsec.Lock();
! if (oldHandle) {
! // if window previously closed, this may fail when the Python object
! // destructs - but this is not a problem.
! RemoveAssoc(oldHandle);
! }
! if (handle) {
#ifdef DEBUG
! // overwriting an existing entry probably means we are failing to
! // detect the death of the old object and its address has been reused.
! if (object) { // might just be nuking ours, so we expect to find outself!
! PyObject *existing_weakref;
! if (map.Lookup(handle, (void *&)existing_weakref)) {
! TRACE("CAssocManager::Assoc overwriting existing assoc\n");
! // DebugBreak();
! }
}
#endif
! RemoveAssoc(handle);
! if (object) {
! PyObject *weakref = PyWeakref_NewRef(object, NULL);
! if (weakref)
! // reference owned by the map.
! map.SetAt(handle, weakref);
! else {
! TRACE("Failed to create weakref\n");
! gui_print_error();
! DebugBreak();
! }
}
}
--- 77,105 ----
}
! void CAssocManager::Assoc(void *handle, ui_assoc_object *object)
{
m_critsec.Lock();
! ASSERT(handle);
#ifdef DEBUG
! // overwriting an existing entry probably means we are failing to
! // detect the death of the old object and its address has been reused.
! if (object) { // might just be nuking ours, so we expect to find outself!
! PyObject *existing_weakref;
! if (map.Lookup(handle, (void *&)existing_weakref)) {
! TRACE("CAssocManager::Assoc overwriting existing assoc\n");
! DebugBreak();
}
+ }
#endif
! RemoveAssoc(handle);
! if (object) {
! PyObject *weakref = PyWeakref_NewRef(object, NULL);
! if (weakref)
! // reference owned by the map.
! map.SetAt(handle, weakref);
! else {
! TRACE("Failed to create weakref\n");
! gui_print_error();
! DebugBreak();
}
}
***************
*** 273,305 ****
TRACE("Destroying association with %p and %s",this,szRep);
#endif
! // note that _any_ of these may cause this to be deleted, as the reference
! // count may drop to zero. If any one dies, and later ones will fail. Therefore
! // I incref first, and decref at the end.
! // Note that this _always_ recurses when this happens as the destructor also
! // calls us to cleanup. Forcing an INCREF/DODECREF in that situation causes death
! // by recursion, as each dec back to zero causes a delete.
! // (*sob* - but in that case, the INCREF of the object shouldn't be necessary -
! // if anyone touches a refcount of our dead object we will end up crashing - and
! // if noone does touch the refcount, we should not need to bump it for the duration.)
! BOOL bDestructing = ob_refcnt==0;
! if (!bDestructing)
! Py_INCREF(this);
! DoKillAssoc(bDestructing); // kill all map entries, etc.
! SetAssocInvalid(); // let child do whatever to detect
! if (!bDestructing)
! DODECREF(this);
! }
! // the virtual version...
! // ASSUMES WE HOLD THE PYTHON LOCK as for all Python object destruction.
! void ui_assoc_object::DoKillAssoc( BOOL bDestructing /*= FALSE*/ )
! {
! // In Python debug builds, this can get recursive -
! // Python temporarily increments the refcount of the dieing
! // object - this object death will attempt to use the dieing object.
! PyObject *vi = virtualInst;
! virtualInst = NULL;
! Py_XDECREF(vi);
// virtuals.DeleteAll();
! handleMgr.Assoc(0,this,assoc);
}
--- 267,274 ----
TRACE("Destroying association with %p and %s",this,szRep);
#endif
! Py_CLEAR(virtualInst);
// virtuals.DeleteAll();
! handleMgr.Assoc(assoc, 0);
! SetAssocInvalid(); // let child do whatever to detect
}
Index: win32win.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32win.cpp,v
retrieving revision 1.21.2.2
retrieving revision 1.21.2.3
diff -C2 -d -r1.21.2.2 -r1.21.2.3
*** win32win.cpp 28 Dec 2008 10:55:49 -0000 1.21.2.2
--- win32win.cpp 28 Dec 2008 12:53:32 -0000 1.21.2.3
***************
*** 610,622 ****
if (pWnd) {
if (bDidSubclass) {
- // pWnd->Detach();
pWnd->UnsubclassWindow();
bDidSubclass = FALSE;
}
- // DONT detach - bDidSubclass is only logic needed.
- // if (pWnd->GetSafeHwnd()) {
- // TRACE("Warning - DoKillAssoc detaching from existing window\n");
- // pWnd->Detach();
- // }
if (bManualDelete) {
// Release the lock while we destroy the object.
--- 610,616 ----
Index: win32cmd.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32cmd.h,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -C2 -d -r1.1.4.1 -r1.1.4.2
*** win32cmd.h 28 Dec 2008 10:55:49 -0000 1.1.4.1
--- win32cmd.h 28 Dec 2008 12:53:32 -0000 1.1.4.2
***************
*** 15,20 ****
CMapWordToPtr *pCommandUpdateHookList;
- virtual void DoKillAssoc( BOOL bDestructing = FALSE );
-
// virtuals for Python support
virtual CString repr();
--- 15,18 ----
Index: win32dlg.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32dlg.cpp,v
retrieving revision 1.10.2.3
retrieving revision 1.10.2.4
diff -C2 -d -r1.10.2.3 -r1.10.2.4
*** win32dlg.cpp 28 Dec 2008 10:55:49 -0000 1.10.2.3
--- win32dlg.cpp 28 Dec 2008 12:53:32 -0000 1.10.2.4
***************
*** 175,194 ****
}
- PyCWnd::DoKillAssoc(TRUE);
ui_assoc_object::SetAssocInvalid(); // must call this explicitely, as I ignore SetAssocInvalid
! Py_XDECREF(ddlist);
! Py_XDECREF(dddict);
! }
! void PyCDialog::DoKillAssoc(BOOL bDestructing /*=FALSE*/ )
! {
! // we can not have the pointer deleted at window destruction time
// for a dialog (as MFC still needs it after the dialog has completed
BOOL bManDeleteSave = bManualDelete;
! if (!bDestructing)
! bManualDelete = FALSE;
! PyCWnd::DoKillAssoc(bDestructing);
! if (!bDestructing)
! bManualDelete = bManDeleteSave;
}
PyObject *
PyCDialog::getattro(PyObject *obname)
--- 175,185 ----
}
ui_assoc_object::SetAssocInvalid(); // must call this explicitely, as I ignore SetAssocInvalid
! Py_XDECREF(ddlist); // we can not have the pointer deleted at window destruction time
// for a dialog (as MFC still needs it after the dialog has completed
BOOL bManDeleteSave = bManualDelete;
! Py_XDECREF(dddict);
}
+
PyObject *
PyCDialog::getattro(PyObject *obname)
Index: win32assoc.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32assoc.h,v
retrieving revision 1.2.4.1
retrieving revision 1.2.4.2
diff -C2 -d -r1.2.4.1 -r1.2.4.2
*** win32assoc.h 28 Dec 2008 10:55:48 -0000 1.2.4.1
--- win32assoc.h 28 Dec 2008 12:53:32 -0000 1.2.4.2
***************
*** 23,27 ****
CAssocManager();
~CAssocManager();
! void Assoc(void *assoc, ui_assoc_object *PyObject, void *oldAssoc=NULL);
ui_assoc_object *GetAssocObject(void * handle);
--- 23,27 ----
CAssocManager();
~CAssocManager();
! void Assoc(void *assoc, ui_assoc_object *PyObject);
ui_assoc_object *GetAssocObject(void * handle);
***************
*** 79,87 ****
void *GetGoodCppObject(ui_type *ui_type_check=NULL) const;
virtual bool CheckCppObject(ui_type *ui_type_check) const {return true;}
- // Does the actual killing.
- virtual void DoKillAssoc( BOOL bDestructing = FALSE ); // does the actual work.
// Called during KillAssoc - normally zeroes association.
// Override to keep handle after destruction (eg, the association
// with a dialog is valid after the Window's window has closed).
virtual void SetAssocInvalid() { assoc = 0; }
--- 79,86 ----
void *GetGoodCppObject(ui_type *ui_type_check=NULL) const;
virtual bool CheckCppObject(ui_type *ui_type_check) const {return true;}
// Called during KillAssoc - normally zeroes association.
// Override to keep handle after destruction (eg, the association
// with a dialog is valid after the Window's window has closed).
+ // XXX? bogus too?
virtual void SetAssocInvalid() { assoc = 0; }
Index: win32gdi.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32gdi.cpp,v
retrieving revision 1.2.4.1
retrieving revision 1.2.4.2
diff -C2 -d -r1.2.4.1 -r1.2.4.2
*** win32gdi.cpp 28 Dec 2008 10:55:49 -0000 1.2.4.1
--- win32gdi.cpp 28 Dec 2008 12:53:32 -0000 1.2.4.2
***************
*** 39,43 ****
PyCGdiObject::~PyCGdiObject()
{
- //DoKillAssoc(TRUE);
}
--- 39,42 ----
Index: win32cmd.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32cmd.cpp,v
retrieving revision 1.5.2.2
retrieving revision 1.5.2.3
diff -C2 -d -r1.5.2.2 -r1.5.2.3
*** win32cmd.cpp 28 Dec 2008 10:55:48 -0000 1.5.2.2
--- win32cmd.cpp 28 Dec 2008 12:53:32 -0000 1.5.2.3
***************
*** 174,187 ****
PyCCmdTarget::~PyCCmdTarget()
{
- }
-
- // handle is invalid - therefore release all refs I am holding for it.
- void PyCCmdTarget::DoKillAssoc( BOOL bDestructing /*= FALSE*/ )
- {
free_hook_list(this,&pNotifyHookList);
free_hook_list(this,&pOleEventHookList);
free_hook_list(this,&pCommandHookList);
free_hook_list(this,&pCommandUpdateHookList);
- ui_assoc_object::DoKillAssoc(bDestructing);
}
--- 174,181 ----
Index: win32prop.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32prop.h,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -C2 -d -r1.1 -r1.1.4.1
*** win32prop.h 1 Sep 1999 23:33:02 -0000 1.1
--- win32prop.h 28 Dec 2008 12:53:32 -0000 1.1.4.1
***************
*** 16,22 ****
PyCPropertySheet();
virtual ~PyCPropertySheet();
-
- // virtual void DoKillAssoc( BOOL bDestructing=FALSE);
- // virtual void SetAssocInvalid() {return; }//ignore
};
--- 16,19 ----
Index: win32dlg.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32dlg.h,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -C2 -d -r1.1.4.1 -r1.1.4.2
*** win32dlg.h 29 Aug 2008 05:53:29 -0000 1.1.4.1
--- win32dlg.h 28 Dec 2008 12:53:32 -0000 1.1.4.2
***************
*** 21,25 ****
PyCDialog();
virtual ~PyCDialog();
- virtual void DoKillAssoc( BOOL bDestructing=FALSE);
virtual void SetAssocInvalid() {return; }//ignore
public:
--- 21,24 ----
Index: win32hl.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32hl.h,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -C2 -d -r1.1 -r1.1.4.1
*** win32hl.h 1 Sep 1999 23:33:02 -0000 1.1
--- win32hl.h 28 Dec 2008 12:53:32 -0000 1.1.4.1
***************
*** 13,17 ****
CPythonHierControl *GetListObject();
static CPythonHierControl *GetListObject(PyObject *self);
- virtual void DoKillAssoc( BOOL bDestructing = FALSE );
static ui_type_CObject type;
--- 13,16 ----
|