diff options
| author | Crystalwarrior <varsash@gmail.com> | 2019-09-14 01:20:01 +0300 |
|---|---|---|
| committer | Crystalwarrior <varsash@gmail.com> | 2019-09-14 01:20:01 +0300 |
| commit | b608f841003c461d914e6ace0c91a67b884a7b01 (patch) | |
| tree | 8e97d921c2e5605fea236cc7abbb5ea1835c969c /src/courtroom.cpp | |
| parent | 4b452e968d07d4f49f1e6e3c86ba52c6d175033c (diff) | |
Resolve a segfault with screenshake, need to determine a better method to finish previous animation (if it exists) properly.
Diffstat (limited to 'src/courtroom.cpp')
| -rw-r--r-- | src/courtroom.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 3729c982..32e39d09 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1656,21 +1656,24 @@ void Courtroom::handle_chatmessage_2() void Courtroom::do_screenshake() { - if (screenshake_animation_group && screenshake_animation_group->state() == QAbstractAnimation::Running) - screenshake_animation_group->setCurrentTime(screenshake_animation_group->duration()); //Force it to finish and delete itself +//Code below causes segfault, do not uncomment unless you know what you're doing. +// if (screenshake_animation_group != nullptr && screenshake_animation_group->state() == QAbstractAnimation::Running) +// screenshake_animation_group->setCurrentTime(screenshake_animation_group->duration()); //Force it to finish and delete itself screenshake_animation_group = new QParallelAnimationGroup; - QList<QWidget*> affected_list = { + QList<QWidget *> affected_list = { ui_vp_background, ui_vp_player_char, ui_vp_sideplayer_char, - ui_vp_chatbox, + ui_vp_chatbox }; + int i = 0; //I would prefer if this was its own "shake" function to be honest. foreach (QWidget* ui_element, affected_list) { + qDebug() << ++i; QPropertyAnimation *screenshake_animation = new QPropertyAnimation(ui_element, "pos", this); QPoint pos_default = QPoint(ui_element->x(), ui_element->y()); |
