Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
f9d482e1
Commit
f9d482e1
authored
Nov 16, 2012
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comment some code to avoid crash on page change. To be reworked
parent
a2a72d41
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
50 deletions
+61
-50
UBBoardController.cpp
src/board/UBBoardController.cpp
+54
-47
UBDocumentContainer.cpp
src/document/UBDocumentContainer.cpp
+3
-1
UBDocumentNavigator.cpp
src/gui/UBDocumentNavigator.cpp
+4
-2
No files found.
src/board/UBBoardController.cpp
View file @
f9d482e1
...
@@ -1567,57 +1567,64 @@ void UBBoardController::moveSceneToIndex(int source, int target)
...
@@ -1567,57 +1567,64 @@ void UBBoardController::moveSceneToIndex(int source, int target)
void
UBBoardController
::
ClearUndoStack
()
void
UBBoardController
::
ClearUndoStack
()
{
{
QSet
<
QGraphicsItem
*>
uniqueItems
;
// The code has been removed because it leads to a strange error and because the final goal has never been
// go through all stack command
// reached on tests and sound a little bit strange.
for
(
int
i
=
0
;
i
<
UBApplication
::
undoStack
->
count
();
i
++
)
// Strange error: item->scene() crashes the application because item doesn't implement scene() method. I'm
{
// not able to give all the steps to reproduce this error sistematically but is quite frequent (~ twice per utilisation hours)
// strange goal: if item is on the undocommand, the item->scene() is null and the item is not on the deleted scene item list then
UBAbstractUndoCommand
*
abstractCmd
=
(
UBAbstractUndoCommand
*
)
UBApplication
::
undoStack
->
command
(
i
);
// then it's deleted.
if
(
abstractCmd
->
getType
()
!=
UBAbstractUndoCommand
::
undotype_GRAPHICITEM
)
continue
;
// QSet<QGraphicsItem*> uniqueItems;
// // go through all stack command
UBGraphicsItemUndoCommand
*
cmd
=
(
UBGraphicsItemUndoCommand
*
)
UBApplication
::
undoStack
->
command
(
i
);
// for(int i = 0; i < UBApplication::undoStack->count(); i++)
// {
// go through all added and removed objects, for create list of unique objects
// grouped items will be deleted by groups, so we don't need do delete that items.
// UBAbstractUndoCommand *abstractCmd = (UBAbstractUndoCommand*)UBApplication::undoStack->command(i);
QSetIterator
<
QGraphicsItem
*>
itAdded
(
cmd
->
GetAddedList
());
// if(abstractCmd->getType() != UBAbstractUndoCommand::undotype_GRAPHICITEM)
while
(
itAdded
.
hasNext
())
// continue;
{
QGraphicsItem
*
item
=
itAdded
.
next
();
// UBGraphicsItemUndoCommand *cmd = (UBGraphicsItemUndoCommand*)UBApplication::undoStack->command(i);
if
(
!
uniqueItems
.
contains
(
item
)
&&
!
(
item
->
parentItem
()
&&
UBGraphicsGroupContainerItem
::
Type
==
item
->
parentItem
()
->
type
()))
uniqueItems
.
insert
(
item
);
// // go through all added and removed objects, for create list of unique objects
}
// // grouped items will be deleted by groups, so we don't need do delete that items.
// QSetIterator<QGraphicsItem*> itAdded(cmd->GetAddedList());
QSetIterator
<
QGraphicsItem
*>
itRemoved
(
cmd
->
GetRemovedList
());
// while (itAdded.hasNext())
while
(
itRemoved
.
hasNext
())
// {
{
// QGraphicsItem* item = itAdded.next();
QGraphicsItem
*
item
=
itRemoved
.
next
();
// if( !uniqueItems.contains(item) && !(item->parentItem() && UBGraphicsGroupContainerItem::Type == item->parentItem()->type()))
if
(
!
uniqueItems
.
contains
(
item
)
&&
!
(
item
->
parentItem
()
&&
UBGraphicsGroupContainerItem
::
Type
==
item
->
parentItem
()
->
type
()))
// uniqueItems.insert(item);
uniqueItems
.
insert
(
item
);
// }
}
}
// QSetIterator<QGraphicsItem*> itRemoved(cmd->GetRemovedList());
// while (itRemoved.hasNext())
// {
// QGraphicsItem* item = itRemoved.next();
// if( !uniqueItems.contains(item) && !(item->parentItem() && UBGraphicsGroupContainerItem::Type == item->parentItem()->type()))
// uniqueItems.insert(item);
// }
// }
// // go through all unique items, and check, ot on scene, or not.
// // if not on scene, than item can be deleted
// QSetIterator<QGraphicsItem*> itUniq(uniqueItems);
// while (itUniq.hasNext())
// {
// QGraphicsItem* item = itUniq.next();
// UBGraphicsScene *scene = NULL;
// if (item->scene()) {
// scene = dynamic_cast<UBGraphicsScene*>(item->scene());
// }
// if(!scene)
// {
// if (!mActiveScene->deleteItem(item))
// delete item;
// }
// }
// clear stack, and command list
// clear stack, and command list
UBApplication
::
undoStack
->
clear
();
UBApplication
::
undoStack
->
clear
();
// go through all unique items, and check, ot on scene, or not.
// if not on scene, than item can be deleted
QSetIterator
<
QGraphicsItem
*>
itUniq
(
uniqueItems
);
while
(
itUniq
.
hasNext
())
{
QGraphicsItem
*
item
=
itUniq
.
next
();
UBGraphicsScene
*
scene
=
NULL
;
if
(
item
->
scene
())
{
scene
=
dynamic_cast
<
UBGraphicsScene
*>
(
item
->
scene
());
}
if
(
!
scene
)
{
if
(
!
mActiveScene
->
deleteItem
(
item
))
delete
item
;
}
}
}
}
void
UBBoardController
::
adjustDisplayViews
()
void
UBBoardController
::
adjustDisplayViews
()
...
...
src/document/UBDocumentContainer.cpp
View file @
f9d482e1
...
@@ -34,8 +34,10 @@ UBDocumentContainer::UBDocumentContainer(QObject * parent)
...
@@ -34,8 +34,10 @@ UBDocumentContainer::UBDocumentContainer(QObject * parent)
UBDocumentContainer
::~
UBDocumentContainer
()
UBDocumentContainer
::~
UBDocumentContainer
()
{
{
foreach
(
const
QPixmap
*
pm
,
mDocumentThumbs
)
foreach
(
const
QPixmap
*
pm
,
mDocumentThumbs
)
{
delete
pm
;
delete
pm
;
pm
=
NULL
;
}
}
}
void
UBDocumentContainer
::
setDocument
(
UBDocumentProxy
*
document
,
bool
forceReload
)
void
UBDocumentContainer
::
setDocument
(
UBDocumentProxy
*
document
,
bool
forceReload
)
...
...
src/gui/UBDocumentNavigator.cpp
View file @
f9d482e1
...
@@ -92,12 +92,13 @@ void UBDocumentNavigator::generateThumbnails(UBDocumentContainer* source)
...
@@ -92,12 +92,13 @@ void UBDocumentNavigator::generateThumbnails(UBDocumentContainer* source)
{
{
mScene
->
removeItem
(
it
);
mScene
->
removeItem
(
it
);
delete
it
;
delete
it
;
it
=
NULL
;
}
}
for
(
int
i
=
0
;
i
<
source
->
selectedDocument
()
->
pageCount
();
i
++
)
for
(
int
i
=
0
;
i
<
source
->
selectedDocument
()
->
pageCount
();
i
++
)
{
{
const
QPixmap
*
pix
=
source
->
pageAt
(
i
);
const
QPixmap
*
pix
=
source
->
pageAt
(
i
);
Q_ASSERT
(
!
pix
->
isNull
());
int
pageIndex
=
UBDocumentContainer
::
pageFromSceneIndex
(
i
);
int
pageIndex
=
UBDocumentContainer
::
pageFromSceneIndex
(
i
);
UBSceneThumbnailNavigPixmap
*
pixmapItem
=
new
UBSceneThumbnailNavigPixmap
(
*
pix
,
source
->
selectedDocument
(),
i
);
UBSceneThumbnailNavigPixmap
*
pixmapItem
=
new
UBSceneThumbnailNavigPixmap
(
*
pix
,
source
->
selectedDocument
(),
i
);
...
@@ -154,6 +155,7 @@ void UBDocumentNavigator::updateSpecificThumbnail(int iPage)
...
@@ -154,6 +155,7 @@ void UBDocumentNavigator::updateSpecificThumbnail(int iPage)
mScene
->
addItem
(
newItem
);
mScene
->
addItem
(
newItem
);
mThumbsWithLabels
[
iPage
].
setThumbnail
(
newItem
);
mThumbsWithLabels
[
iPage
].
setThumbnail
(
newItem
);
delete
oldItem
;
delete
oldItem
;
oldItem
=
NULL
;
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment