Arvin Schnell wrote:
On Thu, Sep 04, 2008 at 03:45:36PM +0200, Stefan Hundhammer wrote:
On Donnerstag, 4. September 2008, Jiří Suchomel wrote:
Because of this:
// Most YCP developers never use the return value of UI::OpenDialog(). That is a fact, and it was meant as a statement of fact. But...
What should I do? Open a dialog stating that I coulnd't open a dialog? Or log an error and abort (what happens already)?
Any action will just make the code unreadable for almost no benefit.
But what you actually *can* do, is really checking whether opening the dialog was successful and only in that case you can close it. See this common example: --- cut --- Wizard module - Opens Wizard a dialog ... UI::OpenDialog() do something UI::CloseDialog() ... Wizard module - Closes a Wizard dialog --- cut --- If you don't check the UI::OpenDialog() return value, UI::CloseDialog closes the Wizard module dialog. --- cut --- Wizard module - Opens Wizard a dialog ... boolean success = (boolean) UI::OpenDialog() do something if (success) UI::CloseDialog() ... Wizard module - Closes a Wizard dialog --- cut --- This is safer and even though it's not perfect, you might recover from that error sometimes. This is, for instance, vitally important for installation because one more UI::CloseDialog() can kill it. Bad luck. Bye Lukas