Author: sh-sh-sh
Date: Fri Jun 6 19:06:12 2008
New Revision: 48139
URL: http://svn.opensuse.org/viewcvs/yast?rev=48139&view=rev
Log:
avoid segfaults if dynamic_casts fail
Modified:
branches/tmp/sh/ncurses-cleanup/ncurses/src/NCPopupMenu.cc
branches/tmp/sh/ncurses-cleanup/ncurses/src/NCRadioButton.cc
branches/tmp/sh/ncurses-cleanup/ncurses/src/NCRadioButtonGroup.cc
branches/tmp/sh/ncurses-cleanup/ncurses/src/NCTree.cc
branches/tmp/sh/ncurses-cleanup/ncurses/src/NCWidget.cc
Modified: branches/tmp/sh/ncurses-cleanup/ncurses/src/NCPopupMenu.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/ncurses-cleanup/ncurses/src/NCPopupMenu.cc?rev=48139&r1=48138&r2=48139&view=diff
==============================================================================
--- branches/tmp/sh/ncurses-cleanup/ncurses/src/NCPopupMenu.cc (original)
+++ branches/tmp/sh/ncurses-cleanup/ncurses/src/NCPopupMenu.cc Fri Jun 6 19:06:12 2008
@@ -69,12 +69,16 @@
{
yuiMilestone() << "CurrentItem: " << getCurrentItem() << endl;
YTableItem * tableItem = dynamic_cast( getCurrentItemPointer() );
- yuiMilestone() << "TableItem: " << tableItem << endl;
- YMenuItem * item = itemsMap[ tableItem ];
- yuiMilestone() << "MenuItem: " << item << endl;
- if ( item && item->hasChildren() )
- ret = NCursesEvent::button;
+ if ( tableItem )
+ {
+ yuiMilestone() << "TableItem: " << tableItem << endl;
+ YMenuItem * item = itemsMap[ tableItem ];
+ yuiMilestone() << "MenuItem: " << item << endl;
+
+ if ( item && item->hasChildren() )
+ ret = NCursesEvent::button;
+ }
break;
}
Modified: branches/tmp/sh/ncurses-cleanup/ncurses/src/NCRadioButton.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/ncurses-cleanup/ncurses/src/NCRadioButton.cc?rev=48139&r1=48138&r2=48139&view=diff
==============================================================================
--- branches/tmp/sh/ncurses-cleanup/ncurses/src/NCRadioButton.cc (original)
+++ branches/tmp/sh/ncurses-cleanup/ncurses/src/NCRadioButton.cc Fri Jun 6 19:06:12 2008
@@ -140,6 +140,7 @@
if ( group )
group->focusPrevButton();
+
break;
case KEY_DOWN:
Modified: branches/tmp/sh/ncurses-cleanup/ncurses/src/NCRadioButtonGroup.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/ncurses-cleanup/ncurses/src/NCRadioButtonGroup.cc?rev=48139&r1=48138&r2=48139&view=diff
==============================================================================
--- branches/tmp/sh/ncurses-cleanup/ncurses/src/NCRadioButtonGroup.cc (original)
+++ branches/tmp/sh/ncurses-cleanup/ncurses/src/NCRadioButtonGroup.cc Fri Jun 6 19:06:12 2008
@@ -66,7 +66,7 @@
void NCRadioButtonGroup::focusNextButton( )
{
int n = 0;
-
+
if ( focusId < radioButtonsCount() )
focusId++;
else if ( focusId == radioButtonsCount() )
@@ -76,16 +76,12 @@
it != radioButtonsEnd();
++it )
{
- n++;
-
- if ( n == focusId )
+ if ( ++n == focusId )
{
NCRadioButton * radioButton = dynamic_cast( *it );
if ( radioButton )
- {
radioButton->setKeyboardFocus();
- }
}
}
}
@@ -112,9 +108,7 @@
NCRadioButton * radioButton = dynamic_cast( *it );
if ( radioButton )
- {
radioButton->setKeyboardFocus();
- }
}
}
}
@@ -128,9 +122,7 @@
NCRadioButton * radioButton = dynamic_cast( *it );
if ( radioButton )
- {
radioButton->setEnabled( do_bv );
- }
}
YRadioButtonGroup::setEnabled( do_bv );
Modified: branches/tmp/sh/ncurses-cleanup/ncurses/src/NCTree.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/ncurses-cleanup/ncurses/src/NCTree.cc?rev=48139&r1=48138&r2=48139&view=diff
==============================================================================
--- branches/tmp/sh/ncurses-cleanup/ncurses/src/NCTree.cc (original)
+++ branches/tmp/sh/ncurses-cleanup/ncurses/src/NCTree.cc Fri Jun 6 19:06:12 2008
@@ -346,9 +346,7 @@
return;
YTreeItem * treeItem = dynamic_cast( item );
-
YUI_CHECK_PTR( treeItem );
-
YTreeItem *citem = getCurrentItem();
if ( !selected && ( treeItem == citem ) )
Modified: branches/tmp/sh/ncurses-cleanup/ncurses/src/NCWidget.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/ncurses-cleanup/ncurses/src/NCWidget.cc?rev=48139&r1=48138&r2=48139&view=diff
==============================================================================
--- branches/tmp/sh/ncurses-cleanup/ncurses/src/NCWidget.cc (original)
+++ branches/tmp/sh/ncurses-cleanup/ncurses/src/NCWidget.cc Fri Jun 6 19:06:12 2008
@@ -43,9 +43,9 @@
if ( myparent )
{
ReparentTo( *myparent );
- }
- yuiDebug() << "CCC " << this << " parent " << myparent << endl;
+ yuiDebug() << "CCC " << this << " parent " << myparent << endl;
+ }
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org