Skip to content

Commit

Permalink
sync: from linuxdeepin/dtkdeclarative
Browse files Browse the repository at this point in the history
Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#418
  • Loading branch information
deepin-ci-robot committed Nov 20, 2024
1 parent eb0dc1f commit 0c18551
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/dquickwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ DQuickWindowAttachedPrivate::DQuickWindowAttachedPrivate(QWindow *window, DQuick
: DObjectPrivate(qq)
, window(window)
, wmWindowTypes(DWindowManagerHelper::UnknowWindowType)
, appLoaderItem(new DQuickAppLoaderItem())
, appLoaderItem(nullptr)
{
}

Expand Down Expand Up @@ -482,6 +482,10 @@ QQmlComponent *DQuickWindowAttached::loadingOverlay() const
DQuickAppLoaderItem *DQuickWindowAttached::appLoader() const
{
D_DC(DQuickWindowAttached);
if (!d->appLoaderItem) {
const_cast<DQuickWindowAttachedPrivate *>(d)->appLoaderItem =
new DQuickAppLoaderItem(window()->contentItem());
}
return d->appLoaderItem;
}

Expand All @@ -494,7 +498,9 @@ void DQuickWindowAttached::setAppLoader(DQuickAppLoaderItem *item)
// AppLoaderItem 会在窗口加载完毕后进行创建,因此
// 在窗口创建初期,AppLoaderItem 需要指定一个默认
// 值,防止 Qt 在运行时出现警告和报错
d->appLoaderItem->deleteLater();
if (d->appLoaderItem) {
d->appLoaderItem->deleteLater();
}
d->appLoaderItem = item;
Q_EMIT appLoaderChanged();
}
Expand Down
6 changes: 4 additions & 2 deletions src/private/dquickcontrolpalette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,11 @@ class Q_DECL_HIDDEN CustomMetaObject : public QQmlOpenMetaObject

}

~CustomMetaObject()
~CustomMetaObject() override
{

if (auto item = type()) {
item->release();
}
}

inline DQuickControlColorSelector *owner() const {
Expand Down

0 comments on commit 0c18551

Please sign in to comment.