Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
61f5cd47
Commit
61f5cd47
authored
Apr 27, 2012
by
Max-Wilhelm Bruker
Browse files
Qt 4.8 crash fix
parent
c7fa2fe9
Changes
3
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/player.cpp
View file @
61f5cd47
...
@@ -1577,10 +1577,9 @@ void Player::delCounter(int counterId)
...
@@ -1577,10 +1577,9 @@ void Player::delCounter(int counterId)
AbstractCounter
*
c
=
counters
.
value
(
counterId
,
0
);
AbstractCounter
*
c
=
counters
.
value
(
counterId
,
0
);
if
(
!
c
)
if
(
!
c
)
return
;
return
;
if
(
c
->
getName
()
==
"life"
)
playerTarget
->
delCounter
();
counters
.
remove
(
counterId
);
c
->
delCounter
();
c
->
delCounter
();
counters
.
remove
(
counterId
);
rearrangeCounters
();
rearrangeCounters
();
}
}
...
@@ -1590,7 +1589,6 @@ void Player::clearCounters()
...
@@ -1590,7 +1589,6 @@ void Player::clearCounters()
while
(
counterIterator
.
hasNext
())
while
(
counterIterator
.
hasNext
())
counterIterator
.
next
().
value
()
->
delCounter
();
counterIterator
.
next
().
value
()
->
delCounter
();
counters
.
clear
();
counters
.
clear
();
playerTarget
->
delCounter
();
}
}
ArrowItem
*
Player
::
addArrow
(
const
ServerInfo_Arrow
&
arrow
)
ArrowItem
*
Player
::
addArrow
(
const
ServerInfo_Arrow
&
arrow
)
...
...
cockatrice/src/playertarget.cpp
View file @
61f5cd47
...
@@ -56,6 +56,13 @@ PlayerTarget::PlayerTarget(Player *_owner, QGraphicsItem *parentItem)
...
@@ -56,6 +56,13 @@ PlayerTarget::PlayerTarget(Player *_owner, QGraphicsItem *parentItem)
fullPixmap
=
QPixmap
();
fullPixmap
=
QPixmap
();
}
}
PlayerTarget
::~
PlayerTarget
()
{
// Explicit deletion is necessary in spite of parent/child relationship
// as we need this object to be alive to receive the destroyed() signal.
delete
playerCounter
;
}
QRectF
PlayerTarget
::
boundingRect
()
const
QRectF
PlayerTarget
::
boundingRect
()
const
{
{
return
QRectF
(
0
,
0
,
160
,
64
);
return
QRectF
(
0
,
0
,
160
,
64
);
...
@@ -136,12 +143,12 @@ AbstractCounter *PlayerTarget::addCounter(int _counterId, const QString &_name,
...
@@ -136,12 +143,12 @@ AbstractCounter *PlayerTarget::addCounter(int _counterId, const QString &_name,
playerCounter
=
new
PlayerCounter
(
owner
,
_counterId
,
_name
,
_value
,
this
);
playerCounter
=
new
PlayerCounter
(
owner
,
_counterId
,
_name
,
_value
,
this
);
playerCounter
->
setPos
(
boundingRect
().
width
()
-
playerCounter
->
boundingRect
().
width
(),
boundingRect
().
height
()
-
playerCounter
->
boundingRect
().
height
());
playerCounter
->
setPos
(
boundingRect
().
width
()
-
playerCounter
->
boundingRect
().
width
(),
boundingRect
().
height
()
-
playerCounter
->
boundingRect
().
height
());
connect
(
playerCounter
,
SIGNAL
(
destroyed
()),
this
,
SLOT
(
delC
ounter
()));
connect
(
playerCounter
,
SIGNAL
(
destroyed
()),
this
,
SLOT
(
c
ounter
Deleted
()));
return
playerCounter
;
return
playerCounter
;
}
}
void
PlayerTarget
::
delC
ounter
()
void
PlayerTarget
::
c
ounter
Deleted
()
{
{
playerCounter
=
0
;
playerCounter
=
0
;
}
}
cockatrice/src/playertarget.h
View file @
61f5cd47
...
@@ -22,12 +22,13 @@ private:
...
@@ -22,12 +22,13 @@ private:
QPixmap
fullPixmap
;
QPixmap
fullPixmap
;
PlayerCounter
*
playerCounter
;
PlayerCounter
*
playerCounter
;
public
slots
:
public
slots
:
void
delC
ounter
();
void
c
ounter
Deleted
();
public:
public:
enum
{
Type
=
typePlayerTarget
};
enum
{
Type
=
typePlayerTarget
};
int
type
()
const
{
return
Type
;
}
int
type
()
const
{
return
Type
;
}
PlayerTarget
(
Player
*
_player
=
0
,
QGraphicsItem
*
parentItem
=
0
);
PlayerTarget
(
Player
*
_player
=
0
,
QGraphicsItem
*
parentItem
=
0
);
~
PlayerTarget
();
QRectF
boundingRect
()
const
;
QRectF
boundingRect
()
const
;
void
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
);
void
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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