From: Andreas H. <and...@bl...> - 2025-07-11 19:12:46
|
Hi Dima I now got a better understanding of this error, but still no real solution. The problem as I can see it is that there are two Swig modules present. Each Swig module has a pointer to a global data structure containing all the swig type info: swig_module->types When cleaning up, the function SWIG_Python_DestroyModule is called which deallocates the type info. If this is called before the destructor of the Fl_Window is called, then the error you are seeing is shown, because part of the information needed to cleanly deallocate the Fl_Window structure is contained in the type info and is now missing. As I see it, this is basically a race condition between the two modules. Besides the factors you have mentioned, also exchanging the import order of fltk and Fl_Gl_Image_Widget seems to resolve the problem. In that case, deallocation of the type info is done by the fltk module, properly after deallocating the Fl_Window. Long story short, at the moment I see no possibility to really fix this. Best regards Andreas On 6/27/25 00:18, Dima Kogan wrote: > Hello! > > Can one of you help debugging a mystery error please? I have this > script, that does more-or-less nothing: > > import Fl_Gl_Image_Widget > from fltk import * > > def func(): > 5 > > window = Fl_Window(100,200,"xxx") > window.end() > window.show() > > Fl.run() > > I run it, the window pops up, I press Escape, the application exits. > This is right. But as it exits it prints to the console: > > swig/python detected a memory leak of type 'Fl_Window *', no destructor found. > > Does this mean something to any of you? I can make this message go away > by doing unrelated-looking things. I can remove the definition of func() > above (which doesn't do anything anyway). Or I can remove the "import > Fl_Gl_Image_Widget" (which also doesn't do anything). Doing any of these > silences the error. > > This is on a very recent Debian, running everything from packages: > > dima@shorty:~/projects/mrcam$ dpkg -l python3-fltk python3-gl-image-display libfltk1.4 > ii python3-fltk:amd64 1.4.2.0-2 amd64 Python wrapper for the Fast Light Toolkit > ii python3-gl-image-display 0.23-1 amd64 OpenGL-based image visualizer > ii libfltk1.4:amd64 1.4.3-1 amd64 Fast Light Toolkit - main shared library > > I just upgraded libfltk1.4 from 1.4.2-7; it made no difference. > > python3-gl-image-display is mine: > > https://github.com/dkogan/GL_image_display > > It also uses swig. Note that here I'm just doing the import; I'm NOT > actually using it. > > Suggestions? Since unrelated-looking things make the problem disappear > for me, I wouldn't be surprised if yall have trouble reproducing. > > Suggestions? > > Thanks! > > > _______________________________________________ > Pyfltk-user mailing list > Pyf...@li... > https://lists.sourceforge.net/lists/listinfo/pyfltk-user |