[Uml-devel] kdesdk/umbrello/umbrello
Brian Thomas
thomas at mail630.gsfc.nasa.gov
Mon Dec 1 21:42:06 UTC 2003
CVS commit by thomas:
fix bug : duplicate 'class diagram' appears when cntl-N is pressed. If cntl-q is then pressed, you get crash. Basically the problem is that removeView not properly implemented. fixed
M +13 -11 umldoc.cpp 1.106
M +3 -1 umldoc.h 1.52
--- kdesdk/umbrello/umbrello/umldoc.cpp #1.105:1.106
@@ -105,5 +106,5 @@ void UMLDoc::addView(UMLView *view) {
}
////////////////////////////////////////////////////////////////////////////////////////////////////
-void UMLDoc::removeView(UMLView *view) {
+void UMLDoc::removeView(UMLView *view , bool enforceCurrentView ) {
if(!view)
{
@@ -123,14 +124,16 @@ void UMLDoc::removeView(UMLView *view) {
currentView = 0L;
UMLView* firstView = m_ViewList.first();
- if (firstView )
- {
- changeCurrentView( firstView->getID() );
- UMLApp::app()->setDiagramMenuItemsState(true);
- }
- else //create a diagram
+ if (!firstView && enforceCurrentView) //create a diagram
{
createDiagram( dt_Class, false );
+ firstView = m_ViewList.first();
//UMLApp::app()->setDiagramMenuItemsState(false);
}
+
+ if ( firstView )
+ {
+ changeCurrentView( firstView->getID() );
+ UMLApp::app()->setDiagramMenuItemsState(true);
+ }
}
}
@@ -465,5 +468,4 @@ UMLView * UMLDoc::findView(int id) {
}
}
- kdDebug() << "Unable to find a view identified by " << id << endl;
return 0;
}
@@ -1877,8 +1879,8 @@ void UMLDoc::removeAllViews() {
// associaiton widgets (but once had them) to remove themselves from
// this document.
- removeView(v);
+ removeView(v, false);
}
m_ViewList.clear();
- currentView = 0;
+ currentView = 0L;
emit sigDiagramChanged(dt_Undefined);
UMLApp::app()->setDiagramMenuItemsState(false);
--- kdesdk/umbrello/umbrello/umldoc.h #1.51:1.52
@@ -102,6 +102,8 @@ public:
*
* @param view Pointer to the UMLView to remove.
+ * @param enforceOneView switch to determine if we have a current view or not.
+ * most of the time, we DO want this, except when exiting the program.
*/
- void removeView(UMLView *view);
+ void removeView(UMLView *view , bool enforceOneView = true );
/**
More information about the umbrello-devel
mailing list