QmlDesigner: Revert "QMLRewriter: Fix the very first child position case

This reverts commit 398b783f1a.

Reason for revert: This crashes on Linux/macOS.

Change-Id: I71068e22bccfc9bcf5f1ada287aa86194c133f5f
Reviewed-by: Ali Kianian <ali.kianian@qt.io>
This commit is contained in:
Thomas Hartmann
2025-04-08 13:49:49 +00:00
parent 7904c434a0
commit 1ff575f93c

View File

@@ -275,6 +275,9 @@ QmlJS::AST::UiObjectMemberList *QMLRewriter::searchMemberToInsertAfter(
QmlJS::AST::UiObjectMemberList *QMLRewriter::searchChildrenToInsertAfter( QmlJS::AST::UiObjectMemberList *QMLRewriter::searchChildrenToInsertAfter(
QmlJS::AST::UiObjectMemberList *members, const PropertyNameList &propertyOrder, int pos) QmlJS::AST::UiObjectMemberList *members, const PropertyNameList &propertyOrder, int pos)
{ {
if (pos < 0)
return searchMemberToInsertAfter(members, propertyOrder);
// An empty property name should be available in the propertyOrder List, which is the right place // An empty property name should be available in the propertyOrder List, which is the right place
// to define the objects there. // to define the objects there.
const int objectDefinitionInsertionPoint = propertyOrder.indexOf(PropertyName()); const int objectDefinitionInsertionPoint = propertyOrder.indexOf(PropertyName());
@@ -288,8 +291,6 @@ QmlJS::AST::UiObjectMemberList *QMLRewriter::searchChildrenToInsertAfter(
int idx = -1; int idx = -1;
if (QmlJS::AST::cast<QmlJS::AST::UiObjectDefinition *>(member)) { if (QmlJS::AST::cast<QmlJS::AST::UiObjectDefinition *>(member)) {
if (pos < 0)
break;
lastObjectDef = iter; lastObjectDef = iter;
if (objectPos++ == pos) if (objectPos++ == pos)
break; break;