[Uml-devel] (no subject)

Luis De la Parra lparrab at gmx.net
Thu Jul 4 02:37:04 UTC 2002

Hi all,

have a problem and maybe someone here knows how to solve it...

summary: if you show a modal dialog (exec()'ing) in UMLApp constructor it

I will be talking here about libraries and services to refer to libraries
and "codegenerators" since the same function could be used in case uml needs to
use some other "plugins" in the future.

I added a initLibraries() function to UMLApp, which basically does the
-1: reads config file for already installed libraries.
-2: scans standard "uml-plugin" directories to see what libraries are there
-3: based on 1 and 2, finds out which of the installed libraries we already
know, which are new (new installed) and which of the libraries we know (knew)
are now missing (were de-installed)

so far so good... now, for libs we already know everything is straight and
easy:just load the information from config, but for new libraries I need to
show a dialog showing the new libraries found so that the user knows and has
the chance to "de-select" some of the services offered by this libraries. (not
use all the services offered by the lib)

In case a library registerd in uml is now missing (the user deleted it) I
want to show a dialog informing that the lib was removed, and the services
offered by it will be removed from the uml-config.

the problem is that this dialogs are shown in initLibraries(), and
initLibraries() is called from UMLApp's constructor, and it crashes!.
I spent a long time last night trying to figure out *why* it was crashing
but I could not find any "obvious" bug in my code, and debug insisted that the
crash was in QDialog::exec() , 

Tried to follow execution inside exec() but nothing seemed wrong.. and then
I noticed that if the dialogs were no-modal it doesn crash, (but it is of no
use either, since I need the response from the dialog to configure the
libraries and creating a non modal dialog on the stack makes it dissapear right
away when we go out of initLibraries() and the user has no time to set up the
libraries, and creating it on free store is of no use either, since the user
can now see the dialog because it stays alive after exiting initLibraries(),
but he can now configure what he wants and wont matter since we cannot read it
because that has to be done in initLibraries().

Then I started to think it crashes because at the time of UMLApp
constructor, the even loop in QT is not yet running. ( I might be wrong here, it is only
a wild guess)

assuming I'm right and the crash is due to the qt even loop not yet being
active: (If I'm wrong just ignore it and tell me what it is!)

Question: how can I solve this:
--1: divie initLibraries in 2 parts, the fist one called from the
constuctors that configures already installed libraries, and part 2 shows the dialogs
for new / removed libraries. Part 2 has to be called then after uml is up and
running... so the problem is how to call this second method automatically
after everything is up and running. (is there a way to get a "delayed callback"
?, ie, that the event loop calls us when it starts running?)

--2: show the first dialog non modal and return, then connect the acept()
slot to the 2 part of the function?? I dont know if this is possible...

I think once I saw a "KDevelop was not shut down properly, do you want to
start with the last used project?" dialog in KDevelop... any ideas how that
works?, KDevelop starts, reads its config and realizes this, ok, but how does it
show this dialog without you pressing anything (who activates this dialog?),
this is kind of what I mean by "delayed callback", or posting an event to be
processed as soon as the even loop starts.

If anyone understood what I am trying to explain (Im not sure I explained
myself clearly=) and has any ideas, *please* let me know.



GMX - Die Kommunikationsplattform im Internet.

More information about the umbrello-devel mailing list