Hello everyone . I found one odd moment in CCGLNViewImpl-desktop.cpp (918 line). Please, look at this code area:
`void GLViewImpl::onGLFWWindowSizeFunCallback(GLFWwindow* /*window*/, int width, int height){
if (width && height && _resolutionPolicy != ResolutionPolicy::UNKNOWN)
{
Size baseDesignSize = _designResolutionSize;
ResolutionPolicy baseResolutionPolicy = _resolutionPolicy;
int frameWidth = width / _frameZoomFactor;
int frameHeight = height / _frameZoomFactor;
setFrameSize(frameWidth, frameHeight); // <-------------- (Problem)
setDesignResolutionSize(baseDesignSize.width, baseDesignSize.height, baseResolutionPolicy);
Director::getInstance()->setViewport();
Director::getInstance()->getEventDispatcher()->dispatchCustomEvent(GLViewImpl::EVENT_WINDOW_RESIZED, nullptr);
}}`
On ubuntu this callback setFrameSize() call GLViewImpl::onGLFWWindowSizeFunCallback in infinite loop and attract memory leak. How fix it? Thank you!
UPD:
I donโt sure it is correct solution, but itโs resolve my problem:
In CCGLViewImpl-desktop.cpp GLViewImpl::updateFrameSize() (643 line) i added checking for glfwSetWindowSize
void GLViewImpl::updateFrameSize() { if (_screenSize.width > 0 && _screenSize.height > 0) {
int w = 0, h = 0;
glfwGetWindowSize(_mainWindow, &w, &h);
int frameBufferW = 0, frameBufferH = 0;
glfwGetFramebufferSize(_mainWindow, &frameBufferW, &frameBufferH);
if (frameBufferW == 2 * w && frameBufferH == 2 * h)
{
if (_isRetinaEnabled)
{
_retinaFactor = 1;
}
else
{
_retinaFactor = 2;
}
glfwSetWindowSize(_mainWindow, _screenSize.width/2 * _retinaFactor * _frameZoomFactor, _screenSize.height/2 * _retinaFactor * _frameZoomFactor);
_isInRetinaMonitor = true;
}
else
{
if (_isInRetinaMonitor)
{
_retinaFactor = 1;
}
#if (CC_TARGET_PLATFORM != CC_PLATFORM_LINUX)
glfwSetWindowSize(_mainWindow, _screenSize.width * _retinaFactor * _frameZoomFactor, _screenSize.height *_retinaFactor * _frameZoomFactor); <-------------
#endif
_isInRetinaMonitor = false;
}
}}`