Skip to content

Commit c0fc921

Browse files
committed
Fix crash when dragging element from more palette to parent
1 parent 5be82b3 commit c0fc921

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/palette/qml/MuseScore/Palette/internal/PaletteTree.qml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ StyledListView {
264264
property var control: null
265265
property var popupModel: null
266266

267+
readonly property bool isPopupOpen: morePopup.active && morePopup.item.isOpened
268+
267269
sourceComponent: MoreElementsPopup {
268270
maxHeight: Math.min(0.75 * paletteTree.height, 500)
269271

@@ -298,7 +300,6 @@ StyledListView {
298300

299301
onClosed: {
300302
enablePaletteAnimations = false;
301-
morePopup.active = false;
302303
}
303304

304305
function scrollToPopupBottom() {
@@ -327,17 +328,20 @@ StyledListView {
327328
}
328329

329330
function close() {
330-
if (morePopup.active) {
331+
if (morePopup.isPopupOpen) {
331332
morePopup.item.close()
332333
}
333334
}
334335

335336
function toggleOpened(model, control, parent) {
336-
if (morePopup.active) {
337+
if (morePopup.isPopupOpen) {
337338
morePopup.close()
338339
return
339340
}
340341

342+
// Force a full re-load of the component (ensures the geometry updates, etc.)
343+
morePopup.active = false
344+
341345
morePopup.parent = parent
342346
morePopup.popupModel = model
343347
morePopup.control = control
@@ -385,7 +389,7 @@ StyledListView {
385389
}
386390

387391
Component.onDestruction: {
388-
if (morePopup.active && morePopup.popupModel === model) {
392+
if (morePopup.isPopupOpen && morePopup.popupModel === model) {
389393
morePopup.close()
390394
}
391395
}
@@ -472,7 +476,7 @@ StyledListView {
472476

473477
highlighted: (activeFocus && !selected) || DelegateModel.isUnresolved
474478

475-
property bool popupExpanded: morePopup.active
479+
property bool popupExpanded: morePopup.isPopupOpen
476480
onPopupExpandedChanged: {
477481
paletteTree.interactive = !popupExpanded
478482
}

0 commit comments

Comments
 (0)