From koffice-devel Fri Feb 10 11:45:43 2006 From: Jaroslaw Staniek Date: Fri, 10 Feb 2006 11:45:43 +0000 To: koffice-devel Subject: Re: Use of processEvents() Message-Id: <43EC7CE7.9060300 () iidea ! pl> X-MARC-Message: https://marc.info/?l=koffice-devel&m=113957214701242 David Faure said the following, On 2006-02-09 18:04: > On Thursday 09 February 2006 10:04, Jaroslaw Staniek wrote: > >>Hmm, in Kexi I am calling processEvents() from within a loop on data loading >>in "data table view" destruction (both actions can a few seconds or more) to >>make GUI more responsive. Both operations are isolated and not GUI-related, >>just loading/destroying some data. Any risks? > > > Yes, if you don't use a modal progress dialog while doing that, then the user > could close the window, and assuming it is deleted and not just leaked, > your code will be running inside a deleted object. Boom. I am trying to make the "time-consuming job" that allows to 'process GUI events' (for now: 'close' or 'open window') separated in terms of data sharing. Later this won't be necessary, as pending jobs will be performed at widgets level, but now entire windows is displayed only when the job is finished. Let's concentrate on the 1st case - opening a window with data taking 5 seconds. I've got procesEvents() inside the loop that loads the data. Thus it's possible that closeProject() will be called in the main window as an answer to 'app quit' event initiated by user. Then I am just looking at 'pending actions' list - it must be empty to allow close the project window. If it's not empty: hmm, I probably need to cancel the event and remember that I should close the dialog when pending jobs are finished. Is there any simpler workaround when we only have one GUI thread? -- regards / pozdrawiam, Jaroslaw Staniek / OpenOffice Polska Kexi Developer: http://www.kexi-project.org | http://koffice.org/kexi Kexi Support: http://www.kexi-project.org/support.html Kexi For MS Windows: http://kexi.pl/wiki/index.php/Kexi_for_MS_Windows KDE3, KDE4 Libraries For Developing MS Windows Applications: http://www.kdelibs.com/wiki _______________________________________________ koffice-devel mailing list koffice-devel@kde.org https://mail.kde.org/mailman/listinfo/koffice-devel