aboutsummaryrefslogtreecommitdiffstats
path: root/libshiboken/bindingmanager.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix ABI break and link error on MS Windows.sb-1.0.8Hugo Parente Lima2012-03-081-3/+3
|
* Update string usage to new Shiboken::String API.Renato Filho2012-03-081-3/+6
|
* Added SBK_PyString_FromCString and SBK_PyString_FromFormat as helper macro ↵Hugo Parente Lima2012-03-081-1/+1
| | | | for Py3k port.
* Using Py_TYPE macro instead of direct access to ob_type to work with Python ↵Hugo Parente Lima2012-03-081-6/+6
| | | | | | 2.x and 3.x. Enclosing PyCObject uses inside #ifdefs
* Replaced all PyString_* by PyBytes_* as preparation for a Python 3.x port.Hugo Parente Lima2012-03-081-1/+1
|
* Fix bug 995 - "QDeclarativeView.itemAt returns faulty reference. (leading to ↵Hugo Parente Lima2012-03-081-2/+17
| | | | SEGFAULT)"
* Check for PYTHONVERBOSE enviroment var to print debug message on bindingRenato Filho2012-03-081-9/+11
| | | | | | | manager exit. Reviewer: Hugo Parente <hugo.lima@openbossa.org> Luciano Wolf <luciano.wolf@openbossa.org>
* Don't return a overload method if the object is dieing.Hugo Parente Lima2012-03-081-1/+3
| | | | | Reviewer: Renato Araújo <renato.filho@openbossa.org> Luciano Wolf <luciano.wolf@openbossa.org>
* Used c++ pointer during the c++ class attribute get function.Renato Araujo Oliveira Filho2012-03-081-2/+0
| | | | | | | | Now all function get for class attribute return the internal memory of the c++ attribute. Reviewer: Hugo Parente <hugo.lima@openbossa.org> Luciano Wolf <luciano.wolf@openbossa.org>
* Print debug messages to stderr isntead of stdout.Hugo Parente Lima2012-03-081-4/+4
|
* Fix object destruction process to avoid pass a invalid object during theRenato Araujo Oliveira Filho2012-03-081-1/+2
| | | | | | | | | __del__ function. Fix bug #505 Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Marcelo Lira <marcelo.lira@openbossa.org>
* Added BindingManager::visitAllPyObjects function, used to visit all ↵Hugo Parente Lima2012-03-081-0/+9
| | | | | | | PyObjects with a function. Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Luciano Wolf <luciano.wolf@openbossa.org>
* Speed up hasWrapper function using the find method instead of count.Hugo Parente Lima2012-03-081-1/+1
|
* Renamed some more internal objects and functions.Hugo Parente Lima2012-03-081-2/+2
|
* Namespace Shiboken::Wrapper renamed to Shiboken::Object.Hugo Parente Lima2012-03-081-1/+1
|
* Rename SbkBaseType back to SbkObjectType.Hugo Parente Lima2012-03-081-11/+11
|
* Created private pointer for Shiboken Meta Type.Renato Araujo Oliveira Filho2012-03-081-19/+24
| | | | | | | Renamed ObjectType to BaseType. Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Hugo Parente Lima <hugo.pl@gmail.com>
* Rewrite parent control functions.Renato Araujo Oliveira Filho2012-03-081-87/+4
| | | | | | | | Updated generator to new API. Fix bug #462 Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Hugo Parente Lima <hugo.pl@gmail.com>
* SbkBaseWrapperType renamed to SbkObjectType.Hugo Parente Lima2012-03-081-11/+11
|
* SbkBaseWrapperType and some other functions used by Python C-API moved ↵Hugo Parente Lima2012-03-081-2/+2
| | | | outside C++ namespaces.
* Removed macros SbkBaseWrapper_instanceDict and SbkBaseWrapper_setInstanceDictHugo Parente Lima2012-03-081-21/+22
|
* SbkBaseWrapper renamed to SbkObjectHugo Parente Lima2012-03-081-10/+10
|
* Replaced SbkBaseWrapper_setOwnership by getOwnership and releaseOwnership ↵Hugo Parente Lima2012-03-081-9/+9
| | | | (both inside Shiboken:Wrapper namespace)
* Moved Shiboken::SbkBaseWrapper outside Shiboken namespace and added a ↵Hugo Parente Lima2012-03-081-12/+12
| | | | d-pointer to it.
* Added BindingManager::getAllPyObjects method.Hugo Parente Lima2012-03-081-6/+14
| | | | | | | This functions returns all PyObjects under the umbrella of BindingManager. Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Renato Araújo <renato.filho@openbossa.org>
* Shiboken::showWrapperMap debug function now shows the refcount of held wrappers.Marcelo Lira2012-03-081-2/+6
| | | | | Reviewed by Luciano Wolf <luciano.wolf@openbossa.org> Reviewed by Renato Araújo <renato.filho@openbossa.org>
* Avoid possible race condition when destroying wrappers.Hugo Parente Lima2012-03-081-6/+7
|
* Implement support to object list on ownserhsip functions.renatofilho2012-03-081-0/+16
| | | | | Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Luciano Wolf <luciano.wolf@openbossa.org>
* Created a new rule to parent ownership.renatofilho2012-03-081-0/+40
| | | | | | | In the new rule if the child object is a Shiboken wrapper class, the object is not invalidade during the parent destructions, the binding manager will wait for object destructor to invalidade the wrapper. Reviewer: Hugo Parente Lima <hugo.pl@gmail.com> Luciano Wolf <luciano.wolf@openbossa.org>
* Change the license boiler plates of all LGPL files removing the special ↵Hugo Parente Lima2010-09-091-20/+8
| | | | | | | exception. Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Renato Araújo <renato.filho@openbossa.org>
* Fix the type resolver algorithm.Hugo Parente Lima2010-08-301-1/+68
| | | | | | | | | | | | | | | | | The new algorithm do the following: - Try to use type_info on the object the get the object real name. - Try to find a type resolver with the name returned by type_info. - If a type resolver was found, get the python type. - Else, ask binding manager to resolve the type walking on all possible subclasses found in the inheritance tree. The binding manager has a graph representing the class inheritance tree. Note: This commit break the libshiboken ABI, but not the API. Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Renato Araújo <renato.araujo@openbossa.org>
* Verify if the arg received on invalidateWrapper, is Py_None or NULL.Renato Filho2010-08-251-1/+1
| | | | | Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Hugo Parente Lima <hugo.pl@gmail.com>
* Invalidate remaining instances when shutting downsb-0.4.0Lauro Neto2010-08-031-0/+8
| | | | | | | | | | | | Instead of using assert(), invalidate the remaining instances in ~BindingManager(). This will prevent them of trying to access it again. As the program is already finishing, the dangling C++ instances will be freed anyway. Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Reviewer: Renato Filho <renato.filho@openbossa.org>
* Fixed reference leak on shiboken make tuple.Renato Filho2010-07-291-0/+6
| | | | | Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Luciano Wolf <luciano.wolf@openbossa.org>
* BindingManager destructor now asserts if the wrapper map is empty.Marcelo Lira2010-07-271-0/+11
| | | | | | | | | | | | | The assertion is only used in debug mode. The duck punching test was altered to avoid failing when run with debug. Check the duck punching test file for a better explanation. Also added a debug helper method "showWrapperMap" to the binding manager, it shows the contents of the C pointer to Python wrapper mapping. Reviewed by Luciano Wolf <luciano.wolf@openbossa.org> Reviewed by Renato Araújo <renato.filho@openbossa.org>
* Add support for multiple inheritance involving more than one C++ object.Hugo Lima2010-03-301-10/+17
|
* Removed "Shibo" prefix from ShiboParent and ShiboChildrenList.Hugo Lima2010-03-301-1/+1
| | | | We are under Shiboken namespace, so there is no need for yet another prefix.
* Adds support for Duck Punching (aka Monkey Patching).Marcelo Lira2010-01-211-0/+8
| | | | | | | | | | | | | | | | The simplest definition of duck punching for our purposes is the ability to change the definition of a method in an instance of a class. To allow this behaviour the SbkBaseWrapper structure had to be extended with a 'ob_dict' which is a PyObject pointer to the instance dictionary. It is originally set to NULL until the user tries to access it. This dictionary could be accessed through the '__dict__' instance property. For now it is read-only. The generator was updated to handle the instance dictionary, and an extensive duck punching test was also added. Reviewed by Hugo Parente Lima <hugo.lima@openbossa.org>
* Fix object initialization.Hugo Lima2010-01-131-7/+26
| | | | | | | The C++ object instanciation was made in tp_init function instead of tp_new function. Now tp_new just create a useless python object which will be filled in the tp_init function. Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
* Renamed ShiboTypeObject to SbkBaseWrapperType to clearify its relationship ↵Marcelo Lira2009-12-111-2/+2
| | | | with SbkBaseWrapper.
* Renamed a lot of Shiboken things with "Py" prefix to use "Sbk" prefix.Marcelo Lira2009-12-081-9/+9
| | | | | | | | | | | | | | To avoid confusion of Python stuff with Shiboken generated stuff. For example: a C++ class called "String" would have the PyString_Type wrapper generated for it, mixing with the proper Python PyString_Type; now the generate code will have things like SbkString_Type, SbkString_New, SbkString_someMethod, and so on. PyBaseWrapper and its variants were renamed to SbkBaseWrapper. PyType<T>() is now SbkType<T>() PyEnumObject was renamed to SbkEnumObject.
* Modified the BindingManager::getOverride method to use Python __mro__.Marcelo Lira2009-12-021-14/+21
| | | | | | | | | Using the CLASS->tp_mro, which contains the list of method resolution for a Python class, to find an override for a wrapped C++ virtual method is more correct than relying in the ShiboTypeObject's baseWrapperType value. Also baseWrapperType was removed from ShiboTypeObject structure. Reviewed by Hugo Lima <hugo.lima@openbossa.org>
* Added method to take care of the details of ownership transfer to C++.Marcelo Lira2009-11-301-0/+11
| | | | | | | | | | | | | | | | | | | Simple ownership transference, i.e. without parenting, is now performed by the new BindingManager::transferOwnershipToCpp method. It remove the parent of the transfered object and proceeds transfer or invalidation if needed. The generated code for simple ownership transfer from Python to C++ now reflects this change. Fixed the method BlackBox::keepObjectType that steals an ObjectType ownership to C++ to remove it from its parent also. The BlackBox class does not take care of the stolen object as a proper parent would, but its destructor deletes the object, so the "unparenting" is needed to avoid freeing the same memory twice. Created an unit test that adds children to a parent ObjectType and then steal the children to C++ with BlackBox.keepObjectType. Reviewed by Hugo Lima <hugo.lima@openbossa.org>
* Wrapper invalidation method recursively updates children objects status.Marcelo Lira2009-11-301-2/+10
| | | | | | | | | | | BindingManager::invalidateWrapper checks if the object to be invalidated carries any children objects and recursively invalidates them. Shiboken::destroyParentInfo function was refactored to call the new recursive wrapper invalidator and then call a helper function that only destroy the parent information. The invalidate parent test was updated.
* Added convenience method BindingManager::invalidateWrapper(const void*).Marcelo Lira2009-11-261-0/+7
| | | | | | | | This new invalidateWrapper finds the Python wrapper for a C++ pointer and then invalidates it. Virtual destructors for C++ wrappers call the invalidateWrapper on the "this" pointer.
* BindingManager::invalidateWrapper also removes ownership of the object from ↵Marcelo Lira2009-11-261-0/+1
| | | | Python.
* Added the invalidateWrapper method to BindingManager.Marcelo Lira2009-11-251-9/+17
| | | | | | | | | | | | It sets the wrapper as invalid and removes the relation of C++ objects to the Python wrapper from the mappings. Moved BindingManager::releaseWrapper(void*) to BindingManagerPrivate, since it should only be used by releaseWrapper(PyObject*). Modified includes on conversions.h to use quotes instead of < and >. Reviewed by Hugo Lima <hugo.lima@openbossa.org>
* Merged with multipleinheritance branchMarcelo Lira2009-11-251-2/+11
|\
| * Binding manager releaseWrapper(PyObject*) method fixed to releaseMarcelo Lira2009-11-181-1/+10
| | | | | | | | | | the multiple inheritance pointers registered for a class with this trait.
| * Shiboken retrieves a Python wrapper object from its correspondingMarcelo Lira2009-11-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | C++ object using the memory address of the former to retrieve the latter. When multiple inheritance is involved, a C++ object passed to C++ could be caught back downcasted to one of its parents with a different memory address, following the memory layout for multiple inheritance used by the compiler. This poses a problem to keep the Python identity of a C++ object. The solution was to extend the traditional PyTypeObject with a number array with all the possible displacements to be added to an object pointer to produce the memory addresses for the valid pointers that could appear from all the possible type casts involving the object parents. All the possible pointers are registered (and unregistered) by the binding wrapper manager. To store the multiple inheritance information the ShiboTypeObject structure was created, expanding the original PyTypeObject with two fields: mi_offsets an integer array containing the possible displacements from the object base pointer. The array has the value -1 at its end. mi_init the function that will initialize the mi_offsets array it is called at the first instaciation of a multiple inheriting object.