tw_wuxutao 发表于 5 天前

pc端使用GUI:Win_Close(parent)报错

stack traceback:
       cocos2d::WavesTiles3D::clone, address 0x699AAD.
       cocos2d::WavesTiles3D::clone, address 0x699AAD.
       lua_pcall, address 0x6F1673C0.
       cocos2d::ActionInterval::clone, address 0x557570.
       cocos2d::__Dictionary::clone, address 0x712A6A.
       cocos2d::Vec3::operator>, address 0x5203345B.
       cocos2d::ui::Widget::releaseUpEvent, address 0x521C9BA6.
       cocos2d::extension::Invocation::invoke, address 0x52050A74.
       cocos2d::Renderer::operator=, address 0x52052494.
       cocos2d::Configuration::operator=, address 0x520ABC8C.
       cocos2d::EventMouse::operator=, address 0x520E42BC.
       cocos2d::EventMouse::operator=, address 0x520E42BC.
       cocos2d::Vec3::operator>, address 0x5203345B.
       cocos2d::EventDispatcher::dispatchTouchEventToListeners, address 0x520E5717.
       cocos2d::EventDispatcher::dispatchTouchEvent, address 0x520E5568.
       cocos2d::EventDispatcher::dispatchEvent, address 0x520E52FE.
       cocos2d::GLView::handleTouchesOfEndOrCancel, address 0x521898B8.
       cocos2d::GLView::handleTouchesEnd, address 0x52189703.
       cocos2d::GLViewImpl::onGLFWMouseCallBack, address 0x5218EE89.
       cocos2d::GLViewImpl::onGLFWKeyCallback, address 0x5218ED88.
       cocos2d::tweenfunc::tweenTo, address 0x5221FFC4.
       MsgWaitForMultipleObjectsEx, address 0x753A7840.
       CallWindowProcW, address 0x753A7670.
       glDebugEntry, address 0x5E616D10.
       Ordinal2713, address 0x753B9680.
       MsgWaitForMultipleObjectsEx, address 0x753A7840.
       CallWindowProcW, address 0x753A7670.
       cocos2d::ui::EditBoxImplWin::hookGLFWWindowProc, address 0x521A9F33.
       Ordinal2713, address 0x753B9680.
       MsgWaitForMultipleObjectsEx, address 0x753A7840.
       DispatchMessageW, address 0x753A6FF0.
       DispatchMessageW, address 0x753A6FF0.
       cocos2d::tweenfunc::tweenTo, address 0x5221FFC4.
       cocos2d::Director::drawScene, address 0x520DFC1A.
       cocos2d::Director::mainLoop, address 0x520E062D.
       cocos2d::ActionInterval::clone, address 0x557570.
       cocos2d::ActionInterval::clone, address 0x557570.
       luaopen_lfs, address 0x774C4C.
       BaseThreadInitThunk, address 0x75225D30.
       RtlInitializeExceptionChain, address 0x7704D140.
       RtlGetAppContainerNamedObjectPath, address 0x7704CF00.



stack traceback:
        : in function 'setLocalZOrder'
        :97: in function 'SetLocalZOrder'
        :324: in function 'CloseLayer'
        :48: in function 'notify'
        :85: in function 'notifyObserver'
        :114: in function 'notifyObservers'
        :331: in function 'notifyObservers'
        :314: in function 'sendNotification'
        :82: in function 'CloseLayer'
        :775: in function 'Win_Close'
        :32: in function 'callback'
        :870: in function <:868>


tw_wuxutao 发表于 5 天前

有大佬知道是什么原因吗?

tw_wuxutao 发表于 5 天前

移动端丶模拟器上正常 , 本地PC端报这个错, 不知道啥原因!

996技术-wang 发表于 4 天前

屏蔽下DEV 只放这个代码看呢

tw_wuxutao 发表于 4 天前

996技术-wang 发表于 2025-9-3 09:21
屏蔽下DEV 只放这个代码看呢

    local parent = GUI:Win_Create(self.Name, 0, 0, 0, 0, false, false, true, false)
    self._parent = parent
    GUI:LoadExport(parent, ui_path, function () end)

    self.ui = GUI:ui_delegate(parent)
    GUI:addOnClickEvent(self.ui.closeBtn, function()
      ViewMgr.close(self.Name)
    end)


function ViewMgr.close(name, ...)
    name = name or "__"
    local ui = ViewMgr.visible_wins
    if ui and ui._parent then
      if ui.onClose and "function" == type(ui.onClose) then                  -- 关闭回调
            ui:onClose(...)
      end
      if ui.HideMain then
            GUI:Win_SetMainHide(ui._parent , false)
      end
      GUI:Win_Close(ui._parent)    -- 这一行报错
      ViewMgr.visible_wins = nil
    else
      SL:release_print("ViewMgr.Close failure ******************",name, ui)
    end
end


tw_wuxutao 发表于 4 天前


996技术-wang 发表于 4 天前

等前端更新后再看看呢

tw_wuxutao 发表于 3 天前

996技术-wang 发表于 2025-9-3 17:32
等前端更新后再看看呢



问题解决了!    但是没搞明白为什么会出现这种情况。
复现步骤:
1. 在客户端GUIUtil入口里Require这个目标按钮的脚本(上图)
2. 进入游戏后打开任意一个npc面板, 使用GUI:Win_close()关闭npc面板 就会报这个错!

移动端丶模拟器上都不会报错但是pc端会, 而且pc端这个按钮不显示, 移动端正常显示!
页: [1]
查看完整版本: pc端使用GUI:Win_Close(parent)报错