Hi there,

once in a blue moon, TeXmacs/Qt happens to crash spontaneously. By switching on core-dumps and debugging symbols in the program that I run every day, I finally managed to capture one such event and identify the problem:

In the routine
   basic_renderer_rep::image_auto_gc()
(file: src/Graphics/Renderer/basic_renderer.cpp), there is a line
   if (diff/fact > 60000) ...
where fact is larger than zero as long as ci->nr is positive.

I guess that the X11 gui takes care that ci->nr never becomes zero, so the check is safe. In the Qt gui, however, that counter obviously can drop to zero, causing a crash at the next garbage collection, which seems to happen spontaneously to the user.

Simple fix:
   if (diff > 60000*fact) ...

This does not solve the underlying problem (why does the counter drop to zero without the image being deallocated right away?) but at least it prevents a mystifying crash.

To be absolutely safe, fact should probably be declared float, otherwise, a few thousand copies of an image (which is unlikely but not completely unrealistic) might cause an int32 overflow.

Greetings,
Norbert


_______________________________________________
Texmacs-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/texmacs-dev

Reply via email to