Hi all, sorry for entering this interesting dicussion so late, but perhaps better late than never.
Mikhail Voitenko wrote: > Hi Daniel, > > On 02/20/09 02:49, Daniel Brosseau wrote: >> Hi Mikhail, Frank, >> >> Thank you again. >> >>> since it would allow returning more information (and thus >>> would have saved you the question, since you would have got a >>> message saying "not allowed for this implementation"). >> >> As an extreemly minor point: >> I got a return of "false" and not "not allowed for this implementation" :) >> >> I have tried loading at the Frame level. I get the Frame >> by first loading a _blank component from the Desktop's >> XComponentLoader and then moving up from the XComponent's >> XModel to the XController to the XFrame. I then get the >> XFrame's XComponentLoader to load subsequent URL's into the Frame. >> >> The load replaces the previous Model but does not close it > > This is a bug. I have just written a small basic script to test this, > and indeed in case a document is loaded as hidden one, the controller > does not close the model. In case of visible documents it works well, > the model is closed. > Could you please write a bug to me. We must be very careful here. When we "invented" XCloseable, we discussed days and weeks what calling close() on models should means for the frames it is in and what calling close() on a frame should mean for the model it contains. One result of this long discussion was that closing visible frames also should try to close the model if no other visible frame exists, closing invisible frames never should close the model insiede. The main reason for that was that hidden frame quite often are created "on the fly" and closing them after usage should not close the model that usually still is needed. Admittedly we did not consider exchanging models in hidden frames, but we should stay inside the architecture to avoid complications or either redesign the complete framework wrt. closing. I think the latter would be exaggeration, so let's define the current state as "works as designed". BTW: there is another reason why hidden and visible frames are different. The lifetime of visible frames is (or can be) controlled by the user, so the frame must control the lifetime of the model. Hidden frames never can be closed by users, so the only way to get rid of them is doing it from the script, macro, extension or application code that created it, so making this code also responsible for controlling the lifetime of the model the frame contains is a bearable effort that - on the bright side - avoids all problems we would get otherwise. >> so I close the previous Model after the Frame is loaded with the new URL. >> If I do not close the previous Model, the memory usage in soffice.bin >> increases continuously with each load. > > Yes, a model has to be closed to end the objects lifetime. This is > designed so, because the complex system of objects let cycle > dependencies appear. And since the controller erroneously does not try > to close it in this case, it stays open. > > In these circumstances your workaround to close the model after it is > replaced in the frame is absolutely correct. After the mentioned above > bug is fixed it will not be necessary any more. As I wrote, I consider the "workaround" to be the correct treatment. > From other side if the frame is closed it disposes the controller. And > the controller should close the related model if it is the last view of > the document. As I explained, that's true only for visible frames. > The fact that the call let office crash/hang is a problem. The > developers guide mentiones that modified documents might be a problem in > this case. Please try to set all remaining documents to nonmodified > state before terminating and probably close them. I wouldn't expect that hidden frames are a problem here. At least that would be a strange bug. I rather think that the hidden frames and its models stay open and terminating the Desktop removes the infrastructure they are built upon. So the right approach should be closing all hidden frames and all models before terminating the desktop. Ciao, Mathias -- Mathias Bauer (mba) - Project Lead OpenOffice.org Writer OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS Please don't reply to "[email protected]". I use it for the OOo lists and only rarely read other mails sent to it. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
