diff --git a/src/app/ViewCoordinator.qml b/src/app/ViewCoordinator.qml index b26178814fbae30b37178e75f387a7c749b9994d..1012ac42a38f2478bd719ac4efe38c2223f926c7 100644 --- a/src/app/ViewCoordinator.qml +++ b/src/app/ViewCoordinator.qml @@ -99,9 +99,9 @@ QtObject { function presentDialog(parent, path, props = {}, singleInstance = false) { // Open the dialog once the object is created let createFunc = singleInstance ? viewManager.createView : viewManager.createUniqueView; - return createFunc(path, parent, function (obj) { + return createFunc(path, parent, function (obj, viewName) { const doneCb = function () { - viewManager.destroyView(path); + viewManager.destroyView(viewName); }; if (obj.closed !== undefined) { obj.closed.connect(doneCb); diff --git a/src/app/ViewManager.qml b/src/app/ViewManager.qml index f61e2669e02009cb0b3d4e6b927ef12fc85354b6..c6db3541a964a2b16cd3c8ae08959a35b798813f 100644 --- a/src/app/ViewManager.qml +++ b/src/app/ViewManager.qml @@ -59,7 +59,7 @@ QtObject { if (views.hasOwnProperty(viewName)) { // an instance of the view already exists if (cb !== null) { - cb(views[viewName]) + cb(views[viewName], viewName) } return views[viewName] } @@ -76,7 +76,7 @@ QtObject { viewName.replace(/^.*[\\\/]/, '').replace(/\.[^/.]+$/, "") viewPaths[friendlyName] = viewName if (cb !== null) { - cb(obj) + cb(obj , viewName) } return views[viewName] } @@ -103,6 +103,7 @@ QtObject { function destroyView(path) { // The view may already have been destroyed. if (!views.hasOwnProperty(path)) { + console.warn("View not found:", path, "Available views:", Object.keys(views)) return false } views[path].destroy()