r17123 by fschmid - Fixed crash when type converting items inside groups
scribus-commit
scribus-commit at lists.scribus.net
Fri Dec 23 20:43:32 UTC 2011
Author: fschmid
Date: Fri Dec 23 20:43:32 2011
New Revision: 17123
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17123
Log:
Fixed crash when type converting items inside groups
Modified:
trunk/Scribus/scribus/scribusdoc.cpp
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17123&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Fri Dec 23 20:43:32 2011
@@ -5328,8 +5328,14 @@
//Take the item to convert from the docs Items list
// PageItem *oldItem = Items->take(currItem->ItemNr);
// Don't use take as we will insert the new item later at the same position
- PageItem *oldItem = Items->at(Items->indexOf(currItem));
- uint oldItemNr = Items->indexOf(currItem);
+ // PageItem *oldItem = Items->at(Items->indexOf(currItem));
+ // wtf ?? why not simply
+ PageItem *oldItem = currItem;
+ uint oldItemNr;
+ if (currItem->Parent != NULL)
+ oldItemNr = currItem->Parent->asGroupFrame()->groupItemList.indexOf(currItem);
+ else
+ oldItemNr = Items->indexOf(currItem);
//Remove old item from the doc's selection if it was in it
bool removedFromSelection=m_Selection->removeItem(oldItem);
//Create a new item from the old one
@@ -5481,7 +5487,13 @@
// Items->at(a)->ItemNr = a;
// Items->insert(oldItem->ItemNr, newItem);
newItem->uniqueNr = oldItem->uniqueNr;
- Items->replace(oldItemNr, newItem);
+ if (oldItem->Parent != NULL)
+ {
+ oldItem->Parent->asGroupFrame()->groupItemList.replace(oldItemNr, newItem);
+ newItem->Parent = oldItem->Parent;
+ }
+ else
+ Items->replace(oldItemNr, newItem);
//FIXME: shouldn't we delete the oldItem ???
//Add new item back to selection if old item was in selection
if (removedFromSelection)
More information about the scribus-commit
mailing list