Closed iomeone closed 5 years ago
https://github.com/Musicoll/Kiwi/blob/482ac74ef71aa5159f7bf721492e8cc53b1deb4f/Client/Source/KiwiApp_Components/KiwiApp_FormComponent.cpp#L478
I do not know if it's a bug. m_alert_box.reset(new AlertBox(message, type, true, [this](){
m_alert_box.reset(new AlertBox(message, type, true, [this](){
the code above capture this variable, but the app will crash with vs2017 compiler .
when m_alert_box.reset(); is executed , the this pointer changes to an invalid pointer. So I rewrite as
m_alert_box.reset(new AlertBox(message, type, true, [this]() { auto p = this; removeChildComponent(m_alert_box.get()); m_alert_box.reset(); p->setBounds(p->getBounds().withHeight(p->getHeight() - p->m_alert_height)); }))
The point is that I save the this variable, and the app will not crash!
Maybe it's vs2017's bug .
https://github.com/Musicoll/Kiwi/blob/482ac74ef71aa5159f7bf721492e8cc53b1deb4f/Client/Source/KiwiApp_Components/KiwiApp_FormComponent.cpp#L478
I do not know if it's a bug.
m_alert_box.reset(new AlertBox(message, type, true, [this](){
the code above capture this variable, but the app will crash with vs2017 compiler .
when m_alert_box.reset(); is executed , the this pointer changes to an invalid pointer.
So I rewrite as
The point is that I save the this variable, and the app will not crash!
Maybe it's vs2017's bug .