Bug 483942

Summary: UI::DumpWidgetTree call Aborts if no dialog exists
Product: [openSUSE] openSUSE 11.2 Reporter: Lukas Ocilka <locilka>
Component: YaST2Assignee: Katarina Machalkova <kmachalkova>
Status: RESOLVED FIXED QA Contact: Jiri Srain <jsrain>
Severity: Normal    
Priority: P5 - None CC: abittner, tgoettlicher
Version: Alpha 0   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: Development Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: YaST log
An ycp-ui-bindings patch resolving the issue

Description Lukas Ocilka 2009-03-10 15:33:25 UTC
Created attachment 278500 [details]
YaST log

Sounds like a feature but in some circumstances it is a bug.

This has been originally reported as bug #483211:

Description:
Automatic Configuration calls several YaST scripts, one of the scripts accidentally closes the current dialog and tries to debug what has happened by calling a debugging function UI::DumpWidget to get something useful to logs. However, UI::DumpWidget finds out there's no dialog present and aborts. Sadly - in the middle of second stage installation.

Solution:
Debugging function should not abort YaST. From YaST point of view, it should log an error and just keep going.

Test file dump.ycp:
-------------------------------------
{
    UI::OpenDialog(`Label("yes/no"));
    UI::CloseDialog();
    UI::DumpWidgetTree();
}
-------------------------------------

Test:
/usr/lib/YaST2/bin/y2base ./dump.ycp qt
terminate called after throwing an instance of 'YUINoDialogException'
  what():  No dialog existing
YaST got signal 6 at YCP file /yast/test/dump.ycp:4
Aborted
Comment 1 Lukas Ocilka 2009-03-10 15:37:15 UTC
See also these logs:
Created an attachment (id=277866)
Created an attachment (id=278403)
Comment 2 Katarina Machalkova 2009-03-10 16:29:10 UTC
Created attachment 278523 [details]
An ycp-ui-bindings patch resolving the issue

Attached is a simplistic patch, which modifies DumpWidgetTree function in such a way that it checks for current dialog in a "non-exception-throwing" mode and only if there is some dialog on the stack, it dumps the widget tree into the log. Otherwise it logs a warning.

Although the above test is a corner case, abort()ing the whole YaST thing because of NULL pointer in debugging function is not nice.
Comment 3 Lukas Ocilka 2009-03-11 09:11:56 UTC
Looks good, please submit into 11.2
Comment 4 Katarina Machalkova 2009-03-11 16:39:53 UTC
y2-ycp-ui-bindings 2.18.5