Bug 323092 - The "The file is still loading" message does not properly go away
Summary: The "The file is still loading" message does not properly go away
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Unclassified
Component: general (show other bugs)
Version: 3.10.97
Platform: unspecified Linux
: VHI crash (vote)
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
: 313017 326829 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-08-01 22:31 UTC by Albert Astals Cid
Modified: 2013-11-01 15:19 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.11.1


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Albert Astals Cid 2013-08-01 22:31:10 UTC
How to reproduce:
 * Close kate
 * Go using sftp:// to a sftp server in konqueror
 * Select two text files, right click and open with kate
 * Both files open with kate
 * Wait for minutes
 * The first file loads correctly and the "The file is still loading" message goes away
 * Change to the other file
 * Wait for minutes (just in case)
 * See that the "The file is still loading" message does not go away
Comment 1 Albert Astals Cid 2013-08-01 22:32:05 UTC
Extra notes:
 * If you press F5 while on the second document kate will crash (will attach gdb and valgrind traces)
 * If you change to the first file and back to the second one the message is gone
Comment 2 Albert Astals Cid 2013-08-01 22:33:08 UTC
The gdb backtrace:

#6  0x00007f8dfe81cb74 in QObject::disconnect (sender=0x3a0070006f0074, signal=0x3343f79 "textChanged(QString)", signal@entry=0x7f8deeb4e0db "2textChanged(const QString&)", receiver=receiver@entry=0x2bd3ef0, method=0x3008cb9 "setText(QString)", method@entry=0x7f8deeb4e0c2 "1setText(const QString&)") at kernel/qobject.cpp:2887
#7  0x00007f8deea9a58c in KateMessageWidget::postMessage (this=0x30ebc20, message=message@entry=0x333cec0, actions=...) at ../../part/view/katemessagewidget.cpp:244
#8  0x00007f8deea746d4 in KateView::postMessage (this=this@entry=0x2bd93d0, message=message@entry=0x333cec0, actions=...) at ../../part/view/kateview.cpp:3183
#9  0x00007f8dee9fcb83 in KateDocument::postMessage (this=0x29c3840, message=0x333cec0) at ../../part/document/katedocument.cpp:5430
#10 0x00007f8dee9f377f in KateDocument::slotTriggerLoadingMessage (this=0x29c3840) at ../../part/document/katedocument.cpp:4865
#11 0x00007f8deea0b3cd in KateDocument::qt_static_metacall (_o=0x29c3840, _id=-206602352, _a=0x7ffff3af8330, _c=<optimized out>) at ./katedocument.moc:304
#12 0x00007f8dfe81da58 in QMetaObject::activate (sender=sender@entry=0x2edcb00, m=m@entry=0x7f8dfeb69e40 <QSingleShotTimer::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x0) at kernel/qobject.cpp:3539
#13 0x00007f8dfe82688a in timeout (this=0x2edcb00) at .moc/release-shared/qtimer.moc:97
#14 QSingleShotTimer::timerEvent (this=0x2edcb00) at kernel/qtimer.cpp:317
#15 0x00007f8dfe821be1 in QObject::event (this=0x2edcb00, e=<optimized out>) at kernel/qobject.cpp:1156
#16 0x00007f8dffd3ddfc in QApplicationPrivate::notify_helper (this=this@entry=0x250d0d0, receiver=receiver@entry=0x2edcb00, e=e@entry=0x7ffff3af8740) at kernel/qapplication.cpp:4567
#17 0x00007f8dffd44470 in QApplication::notify (this=this@entry=0x7ffff3af8c00, receiver=receiver@entry=0x2edcb00, e=e@entry=0x7ffff3af8740) at kernel/qapplication.cpp:4353
#18 0x00007f8dff00c9aa in KApplication::notify (this=0x7ffff3af8c00, receiver=0x2edcb00, event=0x7ffff3af8740) at ../../kdeui/kernel/kapplication.cpp:311
#19 0x00007f8dfe8098bd in QCoreApplication::notifyInternal (this=0x7ffff3af8c00, receiver=0x2edcb00, event=0x7ffff3af8740) at kernel/qcoreapplication.cpp:946
#20 0x00007f8dfe839403 in sendEvent (event=<optimized out>, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#21 QTimerInfoList::activateTimers (this=0x250d550) at kernel/qeventdispatcher_unix.cpp:622
#22 0x00007f8dfe8367a1 in timerSourceDispatch (source=source@entry=0x250d4f0) at kernel/qeventdispatcher_glib.cpp:186
#23 0x00007f8dfda620a6 in g_main_dispatch (context=0x250d430) at /build/buildd/glib2.0-2.37.3/./glib/gmain.c:3058
#24 g_main_context_dispatch (context=context@entry=0x250d430) at /build/buildd/glib2.0-2.37.3/./glib/gmain.c:3634
#25 0x00007f8dfda623f8 in g_main_context_iterate (context=context@entry=0x250d430, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at /build/buildd/glib2.0-2.37.3/./glib/gmain.c:3705
#26 0x00007f8dfda6249c in g_main_context_iteration (context=0x250d430, may_block=1) at /build/buildd/glib2.0-2.37.3/./glib/gmain.c:3766
#27 0x00007f8dfe836a76 in QEventDispatcherGlib::processEvents (this=0x24bfb30, flags=...) at kernel/qeventdispatcher_glib.cpp:426
#28 0x00007f8dffddf9d6 in QGuiEventDispatcherGlib::processEvents (this=<optimized out>, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#29 0x00007f8dfe8085ef in QEventLoop::processEvents (this=this@entry=0x7ffff3af89c0, flags=...) at kernel/qeventloop.cpp:149
#30 0x00007f8dfe8088e5 in QEventLoop::exec (this=this@entry=0x7ffff3af89c0, flags=...) at kernel/qeventloop.cpp:204
#31 0x00007f8dfe80de5b in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1218
#32 0x00007f8dffd3c34c in QApplication::exec () at kernel/qapplication.cpp:3828
#33 0x00007f8e00bf3c75 in kdemain (argc=<optimized out>, argv=<optimized out>) at ../../../kate/app/katemain.cpp:380
#34 0x00007f8e00847de5 in __libc_start_main (main=0x4006d0 <main(int, char**)>, argc=4, ubp_av=0x7ffff3af8d88, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffff3af8d78) at libc-start.c:260
#35 0x0000000000400701 in _start ()
Comment 3 Albert Astals Cid 2013-08-01 22:34:40 UTC
Ok, can't attach a valgrind trace since kate+valgrind crashes somewhere in QTJSC :-/
Comment 4 Dominik Haumann 2013-08-06 18:16:12 UTC
Ok, to elaborate on the current situation: Since we want a smooth transition when showing/hiding the notifications, we use animatedShow() and animatedHide(). To explain the issue, let's focus on animatedHide().

animatedHide() uses a QTimeLine to change the height of the KMessageWidget, until the height is 0 pixel. Then, it calls hide() to finally hide the KMessageWidget.

In the KateMessageWdiget (which uses KMessageWidget), we use an event filter to detect the hide event of the KMessageWdget:
if (obj == m_messageWidget && event->type() == QEvent::Hide /*...*/ ) {
  // (X)
}
Currently, we interpret (X) as "the animation finished, hence either show the next notification, or hide the KateMessageWidget, too".

Interestingly, this idea is the "root of all evil", since the hide event is also triggered when you switch to another document. In the case, the KateView is hidden, another one is shown. In the code itself, we cannot always catch the reason why the KMessageWidget is hidden.

This basic issue leads to quite complex code (e.g. in the hideEvent() of KateMessageWidget) to show the next notification, or to show the current notification again since it simply was hidden by a view change.

The clean solution would be: We need a signal of KMessageWidget when the hide animation is finished, _independent_ of any (additional) hide events. KateMessageWidget could then just connect to this signal, and we would always be sure when to e.g. show the next pending notification.

Currently, KMessageWidget lacks this functionality.

1st solution) add this signal for KDE 4.11.0 (yes, the tag is tomorrow)
2nd solution) we drop animatedHide() and animatedShow() in favour if the fadeIn() and fadeOut() effect we additionally implemented in Kate. We would add a signal here ourselves, and then connect to this signal to finally always accuratly know what to do.

The disadvantage of solution 2 is, that growing and shrinking the widget above the view and below the view looks nicer than fading it in / out: Fade in / out means you have a jump since the widget appears, and the the contents fades in.

What solution do you prefer? Adding the signal is trivial:
diff --git a/kdeui/widgets/kmessagewidget.cpp b/kdeui/widgets/kmessagewidget.cpp
index e5143cc..93fedab 100644
--- a/kdeui/widgets/kmessagewidget.cpp
+++ b/kdeui/widgets/kmessagewidget.cpp
@@ -188,9 +188,11 @@ void KMessageWidgetPrivate::slotTimeLineFinished()
         // We set the whole geometry here, because it may be wrong if a
         // KMessageWidget is shown right when the toplevel window is created.
         content->setGeometry(0, 0, q->width(), bestContentHeight());
+        emit showAnimationFinished();
     } else {
         // Hide
         q->hide();
+        emit hideAnimationFinished();
     }
 }

Albert, Aurelien: What's your take on this? If we go for the patch (untested), it won't be me committing this patch (I'm currently very short on time). Still, I would fix it in Kate Part accordingly.
Comment 5 Albert Astals Cid 2013-08-06 21:47:32 UTC
I don't have an opinion, if you need that, well you need that, i'll leave Aurelien to decide, just mention that you'll probably also need the signals on the 

    if (!(KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects)) {
        hide();
        return;
    }

and

    if (!(KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects)) {
        show();
        return;
    }

shortcuts
Comment 6 Dominik Haumann 2013-08-27 18:49:28 UTC
*** Bug 313017 has been marked as a duplicate of this bug. ***
Comment 7 Dominik Haumann 2013-08-29 10:37:57 UTC
Git commit 487513e4a3573916eff9c417f98896c80c2f6955 by Dominik Haumann.
Committed on 29/08/2013 at 10:36.
Pushed by dhaumann into branch 'master'.

fix notification issues (showing / hiding)

FIXED-IN: 4.11.1
REVIEW: 112320

M  +1    -0    part/CMakeLists.txt
M  +1    -0    part/view/katefadeeffect.cpp
M  +7    -0    part/view/katefadeeffect.h
M  +58   -97   part/view/katemessagewidget.cpp
M  +11   -24   part/view/katemessagewidget.h
M  +15   -17   tests/messagetest.cpp

http://commits.kde.org/kate/487513e4a3573916eff9c417f98896c80c2f6955
Comment 8 Dominik Haumann 2013-08-29 12:33:32 UTC
Git commit a2c1eef1987dae556a0e446f7cddbb672b75ab37 by Dominik Haumann.
Committed on 29/08/2013 at 10:36.
Pushed by dhaumann into branch 'KDE/4.11'.

fix notification issues (showing / hiding)

FIXED-IN: 4.11.1

M  +1    -0    part/CMakeLists.txt
A  +118  -0    part/view/kateanimation.cpp     [License: LGPL (v2+)]
A  +103  -0    part/view/kateanimation.h     [License: LGPL (v2+)]
M  +1    -0    part/view/katefadeeffect.cpp
M  +7    -0    part/view/katefadeeffect.h
M  +60   -97   part/view/katemessagewidget.cpp
M  +11   -24   part/view/katemessagewidget.h
M  +15   -17   tests/messagetest.cpp

http://commits.kde.org/kate/a2c1eef1987dae556a0e446f7cddbb672b75ab37
Comment 9 Dominik Haumann 2013-11-01 15:19:20 UTC
*** Bug 326829 has been marked as a duplicate of this bug. ***