Fix how the return value of OnInit is checked, also DECREF the
PyObjects used there. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@19568 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2,7 +2,15 @@ CHANGES.txt for wxPython
|
|||||||
|
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
2.4.0.5
|
2.4.0.6 (a.k.a. the I'm so stupid release)
|
||||||
|
-------
|
||||||
|
The new deprecation class for the old true/false symbols can now be
|
||||||
|
returned from OnInit. And I promise to be sure I am testing what I
|
||||||
|
think I am testing in the future...
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
2.4.0.5 (a.k.a. the blame it on Kevin release)
|
||||||
-------
|
-------
|
||||||
A few little but annoying bug fixes.
|
A few little but annoying bug fixes.
|
||||||
|
|
||||||
@@ -73,7 +81,7 @@ always call them. The functions are:
|
|||||||
wxApp_SetMacExitMenuItemId
|
wxApp_SetMacExitMenuItemId
|
||||||
wxApp_SetMacHelpMenuTitleName
|
wxApp_SetMacHelpMenuTitleName
|
||||||
|
|
||||||
Refactored, enhanced and added capabilites for the DrawXXXList
|
Refactored, enhanced and added capabilities for the DrawXXXList
|
||||||
functions, inspired by code from Chris Barker.
|
functions, inspired by code from Chris Barker.
|
||||||
|
|
||||||
The wxWindows .mo language catalog files are now installed in a
|
The wxWindows .mo language catalog files are now installed in a
|
||||||
@@ -396,8 +404,8 @@ Added XRCed to the wxPython Tools directory, contributed by Roman
|
|||||||
Rolinsky.
|
Rolinsky.
|
||||||
|
|
||||||
Added a new "constructor" to most of the window classes that calls the
|
Added a new "constructor" to most of the window classes that calls the
|
||||||
default C++ contructor, (the one with no parameters) and also added the
|
default C++ constructor, (the one with no parameters) and also added the
|
||||||
coresponding Create(...) method. This allows you to do a 2-step
|
corresponding Create(...) method. This allows you to do a 2-step
|
||||||
creation of windows which is sometimes required for doing things such
|
creation of windows which is sometimes required for doing things such
|
||||||
as setting extended style flags before the window is created, or for
|
as setting extended style flags before the window is created, or for
|
||||||
passing the object to the XRC resource system to be created from the
|
passing the object to the XRC resource system to be created from the
|
||||||
@@ -933,7 +941,7 @@ methods look like this:
|
|||||||
toggle=FALSE)
|
toggle=FALSE)
|
||||||
|
|
||||||
|
|
||||||
There are also coresponding InsertTool and InsertSimpleTool methods
|
There are also corresponding InsertTool and InsertSimpleTool methods
|
||||||
that additionally take an integer position as the first parameter.
|
that additionally take an integer position as the first parameter.
|
||||||
|
|
||||||
Added a wrapper for the new PCX and TIFF ImageHandlers.
|
Added a wrapper for the new PCX and TIFF ImageHandlers.
|
||||||
|
@@ -13,7 +13,7 @@ from distutils.command.install_data import install_data
|
|||||||
# flags and values that affect this script
|
# flags and values that affect this script
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
VERSION = "2.4.0.5"
|
VERSION = "2.4.0.6"
|
||||||
DESCRIPTION = "Cross platform GUI toolkit for Python"
|
DESCRIPTION = "Cross platform GUI toolkit for Python"
|
||||||
AUTHOR = "Robin Dunn"
|
AUTHOR = "Robin Dunn"
|
||||||
AUTHOR_EMAIL = "Robin Dunn <robin@alldunn.com>"
|
AUTHOR_EMAIL = "Robin Dunn <robin@alldunn.com>"
|
||||||
|
@@ -1 +1 @@
|
|||||||
ver = '2.4.0.5'
|
ver = '2.4.0.6'
|
||||||
|
@@ -445,26 +445,35 @@ PyObject* __wxStart(PyObject* /* self */, PyObject* args)
|
|||||||
// Call the Python App's OnInit function
|
// Call the Python App's OnInit function
|
||||||
arglist = PyTuple_New(0);
|
arglist = PyTuple_New(0);
|
||||||
result = PyEval_CallObject(onInitFunc, arglist);
|
result = PyEval_CallObject(onInitFunc, arglist);
|
||||||
|
Py_DECREF(arglist);
|
||||||
if (!result) { // an exception was raised.
|
if (!result) { // an exception was raised.
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! PyInt_Check(result)) {
|
PyObject* pyint = PyNumber_Int(result);
|
||||||
|
if (! pyint) {
|
||||||
PyErr_SetString(PyExc_TypeError, "OnInit should return a boolean value");
|
PyErr_SetString(PyExc_TypeError, "OnInit should return a boolean value");
|
||||||
return NULL;
|
goto error;
|
||||||
}
|
}
|
||||||
bResult = PyInt_AS_LONG(result);
|
bResult = PyInt_AS_LONG(pyint);
|
||||||
if (! bResult) {
|
if (! bResult) {
|
||||||
PyErr_SetString(PyExc_SystemExit, "OnInit returned FALSE, exiting...");
|
PyErr_SetString(PyExc_SystemExit, "OnInit returned FALSE, exiting...");
|
||||||
return NULL;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
wxTheApp->m_initialized = (wxTopLevelWindows.GetCount() > 0);
|
wxTheApp->m_initialized = (wxTopLevelWindows.GetCount() > 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Py_DECREF(result);
|
||||||
|
Py_DECREF(pyint);
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
return Py_None;
|
return Py_None;
|
||||||
|
|
||||||
|
error:
|
||||||
|
Py_XDECREF(result);
|
||||||
|
Py_XDECREF(pyint);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user