pgui: remove some unnecessary reentrant locking in PGItem

This commit is contained in:
rdb 2018-09-03 17:40:03 +02:00
parent e13a4d6539
commit 217cecb77f

View File

@ -147,8 +147,8 @@ void PGItem::
transform_changed() { transform_changed() {
LightReMutexHolder holder(_lock); LightReMutexHolder holder(_lock);
PandaNode::transform_changed(); PandaNode::transform_changed();
if (has_notify()) { if (_notify != nullptr) {
get_notify()->item_transform_changed(this); _notify->item_transform_changed(this);
} }
} }
@ -161,8 +161,8 @@ void PGItem::
draw_mask_changed() { draw_mask_changed() {
LightReMutexHolder holder(_lock); LightReMutexHolder holder(_lock);
PandaNode::draw_mask_changed(); PandaNode::draw_mask_changed();
if (has_notify()) { if (_notify != nullptr) {
get_notify()->item_draw_mask_changed(this); _notify->item_draw_mask_changed(this);
} }
} }
@ -530,8 +530,8 @@ enter_region(const MouseWatcherParameter &param) {
play_sound(event); play_sound(event);
throw_event(event, EventParameter(ep)); throw_event(event, EventParameter(ep));
if (has_notify()) { if (_notify != nullptr) {
get_notify()->item_enter(this, param); _notify->item_enter(this, param);
} }
} }
@ -554,8 +554,8 @@ exit_region(const MouseWatcherParameter &param) {
play_sound(event); play_sound(event);
throw_event(event, EventParameter(ep)); throw_event(event, EventParameter(ep));
if (has_notify()) { if (_notify != nullptr) {
get_notify()->item_exit(this, param); _notify->item_exit(this, param);
} }
// pgui_cat.info() << get_name() << "::exit()" << endl; // pgui_cat.info() << get_name() << "::exit()" << endl;
@ -580,8 +580,8 @@ within_region(const MouseWatcherParameter &param) {
play_sound(event); play_sound(event);
throw_event(event, EventParameter(ep)); throw_event(event, EventParameter(ep));
if (has_notify()) { if (_notify != nullptr) {
get_notify()->item_within(this, param); _notify->item_within(this, param);
} }
} }
@ -602,8 +602,8 @@ without_region(const MouseWatcherParameter &param) {
play_sound(event); play_sound(event);
throw_event(event, EventParameter(ep)); throw_event(event, EventParameter(ep));
if (has_notify()) { if (_notify != nullptr) {
get_notify()->item_without(this, param); _notify->item_without(this, param);
} }
} }
@ -623,8 +623,8 @@ focus_in() {
play_sound(event); play_sound(event);
throw_event(event); throw_event(event);
if (has_notify()) { if (_notify != nullptr) {
get_notify()->item_focus_in(this); _notify->item_focus_in(this);
} }
} }
@ -644,8 +644,8 @@ focus_out() {
play_sound(event); play_sound(event);
throw_event(event); throw_event(event);
if (has_notify()) { if (_notify != nullptr) {
get_notify()->item_focus_out(this); _notify->item_focus_out(this);
} }
} }
@ -673,8 +673,8 @@ press(const MouseWatcherParameter &param, bool background) {
throw_event(event, EventParameter(ep)); throw_event(event, EventParameter(ep));
} }
if (has_notify()) { if (_notify != nullptr) {
get_notify()->item_press(this, param); _notify->item_press(this, param);
} }
} }
@ -697,8 +697,8 @@ release(const MouseWatcherParameter &param, bool background) {
throw_event(event, EventParameter(ep)); throw_event(event, EventParameter(ep));
} }
if (has_notify()) { if (_notify != nullptr) {
get_notify()->item_release(this, param); _notify->item_release(this, param);
} }
} }
@ -757,8 +757,8 @@ move(const MouseWatcherParameter &param) {
<< *this << "::move(" << param << ")\n"; << *this << "::move(" << param << ")\n";
} }
if (has_notify()) { if (_notify != nullptr) {
get_notify()->item_move(this, param); _notify->item_move(this, param);
} }
} }
@ -1169,9 +1169,10 @@ mouse_to_local(const LPoint2 &mouse_point) const {
*/ */
void PGItem:: void PGItem::
frame_changed() { frame_changed() {
LightReMutexHolder holder(_lock);
mark_frames_stale(); mark_frames_stale();
if (has_notify()) { if (_notify != nullptr) {
get_notify()->item_frame_changed(this); _notify->item_frame_changed(this);
} }
} }