| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The last improvement to signals and slots registration has removed
the problem that mixin classes were not handled the same as other classes.
The key idea was to use the MRO to inspect all involved classes
at type parsing time.
The signals and slots were then sorted in ‘updateMetaObject’.
The current patch enhances this solution in the following way:
In ‘parsePythonType’ we re-ordered the introspection loop in a way
that now all signals are extracted first. This way, they are ordered before
slots automatically, and a later sorting is not necessary. Furthermore,
instead of using qStableSort in ‘updateMetaObject’, we now check the
sorting only with ‘is_sorted’. If the sort order becomes invalid, it will issue a warning.
The latest change removes quadratic time behavior from the warning output.
Important notes and implications:
It is no longer relevant if slots are decorated with @QtCore.Slot().
Signals will work in normally created classes of all shapes.
If classes are modified later, they may grow an incompatibility
when signals appear after slots. Then you get a warning.
Adendum: It makes sense to use slots whenever possible. This way,
constructions as in static_metaobject_test.py work.
Now handling the warning correctly when it is turned into an error.
Correction: We leave the warning as-is and ignore the error!
Question: The static_metaobject_test.py passes its tests suddenly, when you use @Slot() !
Why? Should we open an extra issue for that?
Task-number: PYSIDE-315
Change-Id: I75c9c88787cd93251b1439db0088cd66fc0c3c97
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously when a python QObject-derived class was parsed, only
signals and slots from the top-level class were added to the
corresponding DynamicQMetaObject, and any signals or slots that
were defined in an inherited mixin class were registered at
signal connection time.
This caused issues with already existing connections because
registering new signals shifted all slot indices, thus breaking
the connections (no methods were called, or a wrong method was called
that caused a segmentation fault).
Fix consists in collecting and registering all signals, slots and
properties from a given class, including the mixin clases it derives
from, at type parsing time.
Important notes and implications:
All slots _must_ be decorated with @QtCore.Slot(), otherwise they
will not be registered at type parsing time, but at signal connection
time, and this _will_ cause hard-to-debug issues.
@QtCore.Slot() is not needed for lambdas or free functions, because
those get their own DynamicQMetaObject / QObject pair (via a
GlobalReceiver instance).
Dynamic addition or removal of signals and slots in most situations
will not work (e.g. existing connections will break, QML engine
heavily caches all method indices, and thus will also break).
Task-number: PYSIDE-315
Change-Id: I6213f53653566bde60a469cd239baf969b831560
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
| |
|
|
|
|
|
| |
Replace by C++ casts.
Change-Id: I8f4fe35a4e1529be307728258acf302e1eb9dfe5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Whenever a connection is made to a valid method that was not yet
defined as a slot, the method will be marked as a slot before the
connection proceeds, thus the connection will succeed.
However when connecting using old style SLOT("method()") syntax,
it is possible to provide an invalid signature by specifying the
method name, but forgetting the parentheses.
In such a case, instead of failing and notifying the user, the
connection erroneously succeeded, and on signal emission would not
behave correctly.
This change makes sure to sanity check that dynamically added
signals and slots contain parentheses, thus not causing incorrect
connection creation.
Change-Id: Iaa1a85a2ce698ca31a99100e00b683cfa0cb33cc
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
| |
|
|
|
|
| |
Task-number: PYSIDE-355
Change-Id: I67366fb8ceacbcda80e7f17ad5e5ca80d6847902
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When Python parses a class to find signals and slots, the resulting
list contains the methods in the order they are defined in the source
code. After that, properties are parsed, and the notify ids are set
based on the relative order of the parsed methods.
But because the methods are sorted before their details are put into
the dynamic QMetaObject, the notify id of a property might point to
a wrong method.
This fix makes sure that the relative notify id of every property is
recomputed before being written to the QMetaObject. This allows
QML bindings to work correctly.
Change-Id: I5e50970fee9a42ae8ea551b7891d396b8a6eda97
Reviewed-by: Christian Tismer <tismer@stackless.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
| |
|
|
|
| |
Change-Id: I02b7ff8c1b1dc1e5eac4f1d39b5dabc09143e27c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
| |
|
|
|
|
|
|
| |
Use const reference and use iterators instead of looping
over QMap::values().
Change-Id: I0ab2f1ac9255959c482697e832cea1b7d3c09a30
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
| |
|
|
|
|
|
| |
Add the define in CMakeLists.txt to enforce it in the module.
Change-Id: I430f094400b5a0b6af4e0df564f903e767986b63
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
pyside2/libpyside/dynamicqmetaobject_p.h: In constructor 'PySide::MethodData::MethodData(QMetaMethod::MethodType, const QByteArray&, const QByteArray&)':
pyside2/libpyside/dynamicqmetaobject_p.h:60:33: warning: 'PySide::MethodData::m_mtype' will be initialized after [-Wreorder]
pyside2/libpyside/dynamicqmetaobject_p.h:58:20: warning: 'QByteArray PySide::MethodData::m_signature' [-Wreorder]
pyside2/libpyside/dynamicqmetaobject.cpp:277:1: warning: when initialized here [-Wreorder]
pyside2/libpyside/dynamicqmetaobject.cpp: In member function 'int PySide::DynamicQMetaObject::DynamicQMetaObjectPrivate::createMetaData(QMetaObject*, QLinkedList<QByteArray>&)':
pyside2/libpyside/dynamicqmetaobject.cpp:628:22: warning: narrowing conversion of 'n_info' from 'uint {aka unsigned int}' to 'int' inside { } is ill-formed in C++11 [-Wnarrowing]
pyside2/libpyside/dynamicqmetaobject.cpp:628:22: warning: narrowing conversion of 'n_methods' from 'uint {aka unsigned int}' to 'int' inside { } is ill-formed in C++11 [-Wnarrowing]
pyside2/libpyside/dynamicqmetaobject.cpp:628:22: warning: narrowing conversion of 'n_properties' from 'uint {aka unsigned int}' to 'int' inside { } is ill-formed in C++11 [-Wnarrowing]
pyside2/libpyside/dynamicqmetaobject.cpp:618:10: warning: unused variable 'n_signal' [-Wunused-variable]
pyside2/libpyside/pysideproperty.cpp:114:11: warning: enumeration value 'IndexOfMethod' not handled in switch [-Wswitch]
pyside2/libpyside/pysideproperty.cpp:114:11: warning: enumeration value 'RegisterPropertyMetaType' not handled in switch [-Wswitch]
pyside2/libpyside/pysideproperty.cpp:114:11: warning: enumeration value 'RegisterMethodArgumentMetaType' not handled in switch [-Wswitch]
Task-number: PYSIDE-339
Change-Id: I9fa95e520574549cfa1cdb5215fea1b6669fddd6
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously if a property was defined in python code, libPySide would
register the wrong type id inside the QMetaObject.d.data struct,
specifically it would straight away try to register the type as a
*new* type, without checking if it is a built-in type.
This led to setters not working on the respective property, because
the QVariant which stored the new value, could not be converted to
the type which QMetaObject reported.
Fix consists in checking if the specified property type is a built-in
one, and use it, or register the type as a new one, and make sure
it is tagged as a so-far unresolved type, which will be resolved
later upon access of the property.
Change-Id: Ie5e78a5e760682ce5a98dea138b16354b51c17ae
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
| |\
| |
| |
| |
| |
| |
| | |
https://codereview.qt-project.org/pyside/pyside into use-after-free
From this Gerrit patch:
https://codereview.qt-project.org/#/c/84452/
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
PropertyData::type() returns a new QByteArray (whose `data` is a
copy of the `char*` name of the property)
However the use of `type().data()` on the stack without saving
its reference means the `char*` returned by the `data()` method
is immediately deallocated in the the `~QByteArray` destructor.
(Detected by AddressSanitizer)
The attached patch fixes it by holding a reference to the
QByteArray returned by `type()` for the duration of the method call
Change-Id: Ia794a1215da7ba4bada19091e6d6acf3e6584c70
|
| | | |
|
| | |
| |
| |
| |
| | |
This drastic change is just the beginning of more changes. It shows the real
problem, which was hidden due to the revision mismatch.
|
| |/ |
|
| |
|
|
|
|
|
|
|
| |
Add explicit casts when initializing an int[] using {}'s, as required by
C++11 to be "well formed". This fixes the only (current) -Wnarrowing
warning.
Change-Id: I7f190549a8a54a9061678a926d5478256c2084be
Reviewed-by: John Ehresman <jpe@wingware.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Replaced Nokia copyrights with correct Digia copyrights.
Text in front of copyright is now retained:
** File is part of Foo, Copyright Nokia... ->
** File is part of Foo, Copyright Digia...
Replaced Nokia contact details with Digia's.
Removing "All Rights Reserved" no longer leaves an empty line.
Used the following command:
find . -path '*/3rdparty/*' -prune -o -exec grep -ilI -E
'.*Copyright.*Nokia.*|.*Contact.*' {} \; | tee >(xargs sed -i -r
'1,50 { /INdT|copy[a-z]*[ ]*=/ !{ s/(^[ \t:#*]*)([a-z ]*)
(Copyright.*Nokia.*)/
\1\2Copyright \(C\) 2013 Digia Plc and\/or its subsidiary\(-ies\)\./I
}}') >(xargs sed -i -r '1,50 s/(^[ \t:#*]*)(.*info@qt\.nokia\.com.*
|.*INSERT EMAIL ADDRESS.*|.*qt-info@nokia\.com.*
|.*qt-label1@nokia\.com.*|.*http:\/\/qt\.nokia\.com\/contact.*
|.*qt-sales@nokia\.com.*|.*http:\/\/www\.qt-project\.org\/.*)/
\1Contact: http:\/\/www\.qt-project\.org\/legal/I')
>(xargs sed -i -r '1,50{/(^[ \t:#*]*)(all rights reserved.*)/Id}')
Command now finds command details that point to qt-project.org and
changes them to qt-project.org/legal
Also no longer wrongly replaces code snippet "copyright = ..". Need to
fix these case-by-case later.
Change-Id: I4456c00202c4a2264a400bdc18c19cd097876861
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
|
| |
|
|
|
| |
Change-Id: I876732f90690d9679537611e9a71e33aa3a4e4e3
Reviewed-by: Hugo Parente Lima <hugo.lima@openbossa.org>
|
| | |
|
| | |
|
| |
|
|
|
| |
Reviewed by: Hugo Parente <hugo.lima@openbossa.org>
Lauro Neto <lauro.neto@openbossa.org>
|
| |
|
|
|
| |
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Luciano Wolf <luciano.wolf@openbossa.org>
|
| |
|
|
|
|
| |
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Luciano Wolf <luciano.wolf@openbossa.org>
Renato Araújo <renato.filho@openbossa.org>
|
| | |
|
| |
|
|
|
| |
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>
Lauro Neto <lauro.neto@openbossa.org>
|
| |
|
|
|
| |
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>
Lauro Neto <lauro.neto@openbossa.org>
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This class reproduce the Qt macro Q_CLASSINFO behavior.
Eg.:
@QtCore.ClassInfo(author='PySide', url='http://www.pyside.org')
fixes bug #705.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Hugo Parente Lima <hugo.pl@gmail.com>
|
| |
|
|
|
|
|
|
|
| |
This allow to register signal and slot in any order.
Fixes bug #312
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Hugo Parente Lima <hugo.pl@gmail.com>
|
| |
|
|
|
|
|
| |
Fix bug #671.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Hugo Parente Lima <hugo.pl@gmail.com>
|
| |
|
|
| |
This is used by PySide implementation of QDeclarativeListProperty.
|
| | |
|
| | |
|
| |
|
|
|
|
| |
Empty meta methods cause a assert failure on QtDeclarative module.
Also removed the scoped pointer to avoid heap allocation when it's not
needed, as QByteArray is already implicity shared.
|
| |
|
|
|
|
|
| |
Fixes bug #478
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>
Marcelo Lira <marcelo.lira@openbossa.org>
|
| |
|
|
|
| |
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>
Lauro Moura <lauro.neto@openbossa.org>
|
| |
|
|
| |
Shiboken::callCppDestructor<DynamicQMetaObject> instead.
|
| |
|
|
|
| |
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Lauro Neto <lauro.neto@openbossa.org>
|
| |
|
|
|
| |
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Lauro Neto <lauro.neto@openbossa.org>
|
| |
|
|
|
| |
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Lauro Neto <lauro.neto@openbossa.org>
|
| |
|
|
|
| |
Reviewer: Hugo Parente Lima <hugo.pl@gmail.com>
Luciano Wolf <luciano.wolf@openbossa.org>
|
| |
|
|
|
| |
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>
Marcelo Lira <marcelo.lira@openbossa.org>
|
| | |
|
| | |
|
| |
|
|
| |
It's used by address, so inline it is useless.
|
| |
|
|
| |
Also don't export structs that don't need to be exported.
|
| |
|
|
| |
private header.
|
| | |
|
| |
|
|
| |
This break the ABI.
|