Thanks Orson, Perhaps this patch should be held back for now. Mario reported that he fixed this problem in his new 3DViewer branch, but I don't know the details. Everything works of course if the GL context is not deleted but then we have a memory leak.
- Cirilo On Tue, May 24, 2016 at 5:29 PM, Maciej Sumiński <[email protected]> wrote: > Hi Cirilo, > > I am wondering whether it really solves the problem. C++ standard ([1], > 5.3.5.2) explicitly permits null pointer to be an argument for delete, > so it should not crash there. > > I am afraid the problem might be a bit more entangled. Mario & me have > already noticed a few cases when an OpenGL context switch occurs before > a destructor is called, and as the result OpenGL resources are being > freed in a wrong OGL context. > > It happens because wxWidgets does not permit setting OpenGL context when > the parent window is invisible [2]. The second reason is delayed > wxDialog destruction [3], so we cannot control when it exactly happens, > and almost surely the destructor will be called when the window is > already invisible. Due to that, the following might happen (Mario has > discovered it): > > 1. Display a modal dialog with a OpenGL canvas that uses a different > context > 2. Switch OpenGL context to the just created canvas > 3. Close the modal dialog (it is not destructed yet) > 4. Return to pcbnew, switch OpenGL context to GAL > 5. The dialog destructor is called - officially you cannot switch the > context now, as the dialog is invisible, so you are stuck in the GAL OGL > context. Freeing OGL resources allocated in the dialog will fail, > because it is a wrong context. > > For the moment I do not have any good ideas how to solve the problem in > a clear way. > > Regards, > Orson > > 1. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf > 2. > > http://docs.wxwidgets.org/stable/classwx_g_l_canvas.html#a9f9ab3909606484e717904064d4e7b4f > 3. > > http://docs.wxwidgets.org/trunk/overview_windowdeletion.html#overview_windowdeletion_sequence > > On 05/23/2016 11:35 PM, Cirilo Bernardo wrote: > > The attached patch fixes bug #1572567 (crash on exit from > > 3D Footprint Properties dialog). Since there was no check > > before deleting m_ogl_3dmode, delete can be called on > > NULL. > > > > - Cirilo > > > > > > > > _______________________________________________ > > Mailing list: https://launchpad.net/~kicad-developers > > Post to : [email protected] > > Unsubscribe : https://launchpad.net/~kicad-developers > > More help : https://help.launchpad.net/ListHelp > > > > >
_______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : [email protected] Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp

