Zhao Yuhang
2023-12-09 3a5e5aea06e87710e24db0d7439ab81e3e3d301f
src/core/corewindowagent.cpp
@@ -16,30 +16,28 @@
    CoreWindowAgentPrivate::CoreWindowAgentPrivate() : q_ptr(nullptr), context(nullptr) {
    }
    CoreWindowAgentPrivate::~CoreWindowAgentPrivate() {
        if (context) {
            delete context;
            context = nullptr;
        }
    }
    CoreWindowAgentPrivate::~CoreWindowAgentPrivate() = default;
    void CoreWindowAgentPrivate::init() {
    }
    bool CoreWindowAgentPrivate::setup(const QObject *host, const WindowItemDelegate *delegate) {
        auto ctx =
    AbstractWindowContext *CoreWindowAgentPrivate::createContext() const {
        return
#ifdef Q_OS_WINDOWS
            new Win32WindowContext(host, delegate)
            new Win32WindowContext()
#else
            new QtWindowContext(host, window, delegate)
            new QtWindowContext()
#endif
            ;
        if (!ctx->setup()) {
            delete ctx;
            ctx = nullptr;
                ;
    }
    bool CoreWindowAgentPrivate::setup(QObject *host, WindowItemDelegate *delegate) {
        std::unique_ptr<AbstractWindowContext> ctx(createContext());
        if (!ctx->setup(host, delegate)) {
            return false;
        }
        context = ctx;
        context = std::move(ctx);
        return true;
    }