[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-commits] Commit Complete



Commit by  : gerry
Repository : xara
Revision   : 1664
Date       : Fri Aug  4 11:06:17 BST 2006

Changed paths:
   M /Trunk/XaraLX/Kernel/attrappl.cpp
   M /Trunk/XaraLX/Kernel/backgrnd.cpp
   M /Trunk/XaraLX/Kernel/sgbitmap.cpp
   M /Trunk/XaraLX/Kernel/sgbitmap.h
   M /Trunk/XaraLX/wxOil/sgliboil.cpp

Fixes for bz1343


Diff:
Index: Trunk/XaraLX/Kernel/attrappl.cpp
===================================================================
--- Trunk/XaraLX/Kernel/attrappl.cpp	(revision 1663)
+++ Trunk/XaraLX/Kernel/attrappl.cpp	(revision 1664)
@@ -3431,9 +3431,9 @@
 	SeeAlso:	-
 
 ********************************************************************************************/
-		
+
 void OpApplyAttribToNode::DoWithParam(OpDescriptor* OpDesc, OpParam* pOpParam)		   
-{    
+{
 	ERROR3IF(pOpParam == NULL, "The OpApplyAttribToNode operation requires an attribute parameter"); 
 
 	// Obtain a pointer to the attribute which we will need to apply to all selected nodes 
@@ -3447,12 +3447,12 @@
 		UndoAttribStrID = NewAttr->GetAttrNameID();
 
 	ObjectSet LocalisedCompoundSet; // Every time we localise a compound's attributes we will add the
-						   			// compound to this set.
+									// compound to this set.
 
-   	AttrTypeSet AttrTypes;			// The attribute types to localise and factor out 
+	AttrTypeSet AttrTypes;			// The attribute types to localise and factor out 
 	
-	BOOL NotInterested; 
-	NodeAttribute* OtherAttrib = AttributeManager::GetOtherAttrToApply(NewAttr, &NotInterested);
+	BOOL OtherIsMutate;
+	NodeAttribute* OtherAttr = AttributeManager::GetOtherAttrToApply(NewAttr, &OtherIsMutate);
 
 	// Prepare an ObjChangeParam for use when asking the ink node if we can do this op to it.
 	ObjChangeFlags cFlags;
@@ -3466,16 +3466,15 @@
 	{
 		goto End;
 	}
-	
+
 	// Find out the types of attribute about to be applied, and add them to the AttrTypes set
 	ERROR3IF(NewAttr==NULL,"NewAttr == NULL");
 	AttrTypes.AddToSet((NewAttr->GetAttributeType()));
 
-	if (OtherAttrib != NULL)
+	if (OtherAttr != NULL)
 	{
-		AttrTypes.AddToSet((OtherAttrib->GetAttributeType())); 
+		AttrTypes.AddToSet((OtherAttr->GetAttributeType())); 
 	}
-	
 
 	// If we are applying an attribute to a VTN which is selected then apply the attribute
 	// to this node and all other selected nodes.
@@ -3483,7 +3482,7 @@
 	{
 		AbstractTextChar* Scan = (AbstractTextChar*)InkNode;
 		AbstractTextChar* Last;
-			
+
 		// Find the first selected AbstractTextChar
 		do
 		{
@@ -3498,7 +3497,7 @@
 			Last = Scan;
 			Scan = Scan->FindNextAbstractTextCharInStory();
 		} while ((Scan != NULL) && (Scan->IsSelected()));
-		   
+
 		Range SubSelRange(InkNode, Last, RangeControl(TRUE));
 
 		// Will the ink node (and all its parents) allow this op to happen?
@@ -3508,21 +3507,16 @@
 			goto End;	
 		}
 
-
 		// Invalidate the region before applying the attribute/s
-		BOOL IsMutate;
-		NodeAttribute* OtherAttr = AttributeManager::GetOtherAttrToApply(NewAttr, &IsMutate);
-
 		if (!DoInvalidateRegions(&SubSelRange, 
 								 NewAttr, 
 								 NewAttr->IsAFillAttr(),
 								 OtherAttr,
-								 IsMutate))  //Mutators have to include bounds
+								 OtherIsMutate))  //Mutators have to include bounds
 		{
 			goto End;
 		}
 
-
 		// Apply the attr to all selected AbstractTextChars
 		do
 		{
@@ -3541,12 +3535,10 @@
 								 NewAttr, 
 								 NewAttr->IsAFillAttr(),
 								 OtherAttr,
-								 IsMutate))  //Mutators have to include bounds
+								 OtherIsMutate))  //Mutators have to include bounds
 		{
 			goto End;		
 		}
-
-
 	}
 	else
 	{
@@ -3578,12 +3570,17 @@
 	{
 		FailAndExecute();
 	}
-	  
+
 	End:
 	// First tidy up
 	AttrTypes.DeleteAll();
 	LocalisedCompoundSet.DeleteAll();
-		
+
+	if (OtherAttr)
+	{
+		delete OtherAttr;
+	}
+
 	// then end
 	End(); // End of operation
 }
Index: Trunk/XaraLX/Kernel/backgrnd.cpp
===================================================================
--- Trunk/XaraLX/Kernel/backgrnd.cpp	(revision 1663)
+++ Trunk/XaraLX/Kernel/backgrnd.cpp	(revision 1664)
@@ -668,14 +668,6 @@
 
 	// Now attach the correct bitmap to the fill
 	((AttrFillGeometry*)pBitmapFillAttr)->AttachBitmap(pBitmapToApply);
-	// It would seem that this is necessary to stop kernel bitmap leaks
-	// It only seems to call the delete in the case where we drag a bitmap
-	// from say the bitmap gallery to the page
-	if (((AttrFillGeometry*)pBitmapFillAttr)->GetBitmap() != pBitmapToApply)
-	{
-		// It didn't use the bitmap we gave it, so we can delete it
-		// delete pBitmapToApply;
-	}
 
 	// And now insert it as a child of the regular shape
 	// Factoring should be ok as the Regular Shape is assumed to be the child of
Index: Trunk/XaraLX/Kernel/sgbitmap.h
===================================================================
--- Trunk/XaraLX/Kernel/sgbitmap.h	(revision 1663)
+++ Trunk/XaraLX/Kernel/sgbitmap.h	(revision 1664)
@@ -152,8 +152,6 @@
 	SGDisplayKernelBitmap*	SourceItem;
 	SGMouseInfo				MouseInfo;
 	SGMiscInfo				MiscInfo;
-
-	KernelBitmap*			m_pDragBmp;
 };
 
 /*********************************************************************************************
Index: Trunk/XaraLX/Kernel/sgbitmap.cpp
===================================================================
--- Trunk/XaraLX/Kernel/sgbitmap.cpp	(revision 1663)
+++ Trunk/XaraLX/Kernel/sgbitmap.cpp	(revision 1664)
@@ -308,9 +308,9 @@
 
 GalleryBitmapDragInfo::GalleryBitmapDragInfo(SGDisplayKernelBitmap *pSourceItem,
 											SGMouseInfo *pMouseInfo, SGMiscInfo *pMiscInfo,
- 											BOOL IsAdjust)
-					: BitmapDragInformation(m_pDragBmp = new KernelBitmap(pSourceItem->GetDisplayedKernelBitmap()->ActualBitmap, TRUE), 
-											120,0,0,0, IsAdjust)
+											BOOL IsAdjust)
+					: BitmapDragInformation(pSourceItem->GetDisplayedKernelBitmap(),
+											120, 0, 0, 0, IsAdjust)
 {
 	SourceItem	= pSourceItem;	// Copy the source item pointer
 
@@ -331,8 +331,6 @@
 
 GalleryBitmapDragInfo::~GalleryBitmapDragInfo()
 {
-	if (m_pDragBmp)
-		delete m_pDragBmp;
 }
 
 
@@ -525,7 +523,6 @@
 	// Find the bitmap to apply
 	KernelBitmap* BitmapToApply = TheBitmap;
 	TheBitmap = NULL;
-	m_pDragBmp = NULL;
 
 	if(BitmapToApply == NULL)
 		return FALSE;
@@ -538,13 +535,8 @@
 		AttrBitmapColourFill* Attrib = new AttrBitmapColourFill;
 		if (Attrib == NULL)
 			return FALSE;
-						
+
 		Attrib->AttachBitmap(BitmapToApply);
-		if (Attrib->GetBitmap() != BitmapToApply)
-		{
-			// It didn't use the bitmap we gave it, so we can delete it
-			delete BitmapToApply;
-		}
 
 		AttributeManager::ApplyAttribToNode(pObjectHit, Attrib);
 	}
Index: Trunk/XaraLX/wxOil/sgliboil.cpp
===================================================================
--- Trunk/XaraLX/wxOil/sgliboil.cpp	(revision 1663)
+++ Trunk/XaraLX/wxOil/sgliboil.cpp	(revision 1664)
@@ -946,6 +946,13 @@
 	// Should really check the return value of ApplyFill(...)
 	ApplyFill(pInfo, pBitmap);
 
+	// If we have created a bitmap and it hasn't been added to a list somewhere
+	if (pBitmap && pBitmap->GetParentBitmapList() == NULL)
+	{
+		// Delete it
+		delete pBitmap;
+	}
+
 	// grab the focus
 	GetMainFrame()->SetActiveWindow();
 


Xara