Menu

#2087 SciTE flickers after a while

Bug
closed-fixed
nobody
5
2019-04-16
2019-03-05
No

I've been using SciTE 4.0.3 compiled from source for GTK+ 3.18.9 on Ubuntu 16.04 recently and I didn't have any issues.

Recently, I upgraded to Ubuntu 19.04, and proceeded to compile SciTE 4.1.3 from source for GTK+ 3.24.5. After a while, SciTE starts flickering randomly whenever the screen is refreshed (when the text cursor blinks or is manually moved around).

I ran the previously compiled binary (4.0.3) that I was running on 16.04, and the flicker still occurs after a while, so it doesn't look to be a regression.
I have been unable to observe this behaviour on any other application on my system.

I am also unable to figure out what exactly causes this behaviour, or any reliable way to reproduce it.
It just starts happening after a few hours on its own.
Restarting SciTE temporarily fixes this issue.

I also noticed that whenever this issue occurs, there is also some "corruption" around the scrollbars.

Here is a short video demonstrating this behaviour:
https://vps.tasossah.com/bugs/scite_flicker.mp4

Discussion

  • Tasos Sahanidis

    Tasos Sahanidis - 2019-03-06

    I have found a way to reliably reproduce this bug.

    With no text selected in SciTE, or with text selected in another application, pressing the middle mouse button (activating the X primary selection) to paste text, immediately starts causing this behaviour.

    It does not happen when pasting text selected inside SciTE using the primary selection.

    Hopefully this can narrow it down a bit

     
  • Neil Hodgson

    Neil Hodgson - 2019-03-06

    This seems related to [#1876] and its fix [383b9c] in 4.0.0 which changed the way the primary selection works, moving its control off the Scintilla window to an invisible window.

     

    Related

    Bugs: #1876
    Commit: [383b9c]

  • Tasos Sahanidis

    Tasos Sahanidis - 2019-03-07

    While I was looking through the GTK code to see if I can find out what caused this issue, I came across this which doesn't look like good news for future versions https://gitlab.gnome.org/GNOME/gtk/commit/c35554cf6898b664adfd3e55047f497903adfd5f

     

    Last edit: Tasos Sahanidis 2019-03-07
    • Neil Hodgson

      Neil Hodgson - 2019-03-09

      Ceated issue https://gitlab.gnome.org/GNOME/gtk/issues/1732 .

      Looks like this will only become a problem if/when Scintilla supports GTK 4.x.

       
      • Tasos Sahanidis

        Tasos Sahanidis - 2019-03-09

        Thank you.

        That aside for the moment, is there anything I can do to help debug the flickering? I do use the primary selection quite frequently, and sometimes without even realising it.

        I have tested some readily available versions of GTK in different versions of Ubuntu, and I know so far that this issue does not occur with GTK 3.22.30, but it does happen with 3.24.2.

        I also used GTK_DEBUG=interactive but I didn't see anything of interest that could be at fault.

         
  • Neil Hodgson

    Neil Hodgson - 2019-03-09

    The previous similar bug was really difficult to find and then fix so I'm not eager to plunge in here.

    The first thing to do is to take the middle mouse handling code (ScintillaGTK::PressThis, if (event->button == 2) ) and start disabling lines until the problem stops. Then work out some way to change the way the code to avoid the problem.

     
    • Tasos Sahanidis

      Tasos Sahanidis - 2019-03-13

      Thank you.

      Just a quick update:
      SciTE-wise, it's the gtk_selection_convert call that starts causing the flickering. I have commented out the signal handler for selection_received (as calling that emits that signal), and it still starts flickering.
      Since gtk_selection_convert eventually calls gdk_selection_convert, I tried calling that manually instead. Despite that breaking the clipboard, it still starts causing the flickering, so it's something inside gdk_selection_convert that causes it.

      GTK-Wise, I bisected it, and the flickering starts with this commit https://gitlab.gnome.org/GNOME/gtk/commit/2c7b21718f18ab743cd79784ae28cad582f58503
      Before that commit, the scrollbars would get back (even with the fix for it in https://sourceforge.net/p/scintilla/code/ci/383b9c10d569932a0db878bc9f8b9f8acb21d4e3/ ).

      I am currently unable to bisect which commit the black bars started on, as after some point, GTK only loads Adwaita (and not the system theme), and the scrollbars (due to their size I assume) do not get black.
      I did notice only a square in the corner would get black instead, and bisecting that I found that it was caused by https://gitlab.gnome.org/GNOME/gtk/commit/2ef86c94ed33078628af8d890ffeb82196bf77be

      I do not use Adwaita, however, so I don't know how much this affects me.

       

      Last edit: Tasos Sahanidis 2019-03-13
      • Neil Hodgson

        Neil Hodgson - 2019-03-13

        Those changes seem to only change drawing, the drawing area, and double buffering. They don't say anything about selection handling. What may have happened here is that there is something triggered by selection that results in redrawing. Before 'Simplify the widget' the redrawing may have been hidden by buffering or redrawing a tighter area.

         
  • Neil Hodgson

    Neil Hodgson - 2019-03-25

    Try the attached patch.

     
    • Tasos Sahanidis

      Tasos Sahanidis - 2019-03-27

      I have been using a version compiled with that patch for the past couple of days and the issue seems to be completely fixed.
      Thank you!

       
  • Neil Hodgson

    Neil Hodgson - 2019-03-27
    • labels: SciTE --> SciTE, scintilla, clipboard, primary
    • status: open --> open-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2019-03-27

    Committed fix as [a3dcfd].

     

    Related

    Commit: [a3dcfd]

  • Tasos Sahanidis

    Tasos Sahanidis - 2019-04-05

    Unfortunately, this bug is still present, however under different circumstances.
    It now occurs only when using the primary selection inside SciTE itself.

    For example, with two tabs/files open, selecting text in one tab, then hitting Ctrl+Tab and middle clicking on the other tab will cause this bug again.

    It's also worth noting that it doesn't paste any text, but I don't think it did in the past either.
    It just causes this issue to reappear now.

     
  • Neil Hodgson

    Neil Hodgson - 2019-04-11

    The flickering after primary selection to another tab should be fixed with [22864d]. This has removed the gtk_selection_convert call and thus the possibility of requesting the data as a STRING if it was not available as UTF-8 but that doesn't occur for me with clipboard data from any application tried.

    Primary selection is still not transferred between SciTE tabs as there is a single Scintilla widget that switches files and when the new file is selected the primary selection is unclaimed.

     

    Related

    Commit: [22864d]

    • Tasos Sahanidis

      Tasos Sahanidis - 2019-04-12

      The bug is indeed fixed by that commit.

      Thank you again for all the work. It is very much appreciated.

       
  • Neil Hodgson

    Neil Hodgson - 2019-04-16
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB