Has anyone else noticed that if PD is closed (without closing the patch window) the objects' destructors are not called? Is there some reason for this?
hi,
"Joseph A. Sarlo" wrote:
Has anyone else noticed that if PD is closed (without closing the patch window) the objects' destructors are not called? Is there some reason for this?
Maybe the reason is that to orderly exit one needs not only to call all destructors, but also to close all open canvases and, for any dirty topcanvas, ask user if a file should be saved. If I understand correctly, such a feature is planned for the future, and therefore using some temporary mechanism to be replaced later was considered inconvenient. Moreover it is unnecessary to free ordinary resources (memory, fds) at program termination. However, sometimes one could want something else, of course.
The main point is that we do not need any special mechanism for calling all destructors, because, during closing of a toplevel canvas, destructors of all its objects are invoked (including those in subcanvases).
But anyway, I think forcing all canvases to close, with no questions asked, is really easy and safe -- at least for a regular termination sequence started from quit menu/shortcut (quit message to pdclass). The only two additions needed are:
+// temporary version: works as expected only for nonzero argument +void canvas_closeall(t_floatarg force) +{
canvas_menuclose(x, force);
+}
void glob_quit(void *dummy) {
canvas_closeall(1);
Krzysztof