Yuhang Zhao
2023-12-06 0287f19b3eabf6b6632d51c0288e6cf0be2c5e69
src/core/corewindowagent.cpp
@@ -16,29 +16,30 @@
    CoreWindowAgentPrivate::CoreWindowAgentPrivate() : q_ptr(nullptr), context(nullptr) {
    }
    CoreWindowAgentPrivate::~CoreWindowAgentPrivate() = default;
    CoreWindowAgentPrivate::~CoreWindowAgentPrivate() {
        if (context) {
            delete context;
            context = nullptr;
        }
    }
    void CoreWindowAgentPrivate::init() {
    }
    bool CoreWindowAgentPrivate::setup(QWindow *window, WindowItemDelegate *delegate) {
        Q_ASSERT(window);
        if (!window) {
            return false;
        }
        auto handler =
    bool CoreWindowAgentPrivate::setup(const QObject *host, const WindowItemDelegate *delegate) {
        auto ctx =
#ifdef Q_OS_WINDOWS
            new Win32WindowContext(window, delegate)
            new Win32WindowContext(host, delegate)
#else
            new QtWindowContext(window, delegate)
            new QtWindowContext(host, window, delegate)
#endif
            ;
        if (!handler->setup()) {
            delete handler;
        if (!ctx->setup()) {
            delete ctx;
            ctx = nullptr;
            return false;
        }
        context.reset(handler);
        context = ctx;
        return true;
    }