View Issue Details

IDProjectCategoryView StatusLast Update
0034369LazarusLCLpublic2019-02-01 13:56
ReporterReinhard BergerAssigned ToZeljan Rikalo 
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version1.8.5 (SVN)Product Build 
Target VersionFixed in Version 
Summary0034369: TTreeview.items.addobject & Application.processmessages
Description
When calling "application.processmessages during a loop within a treeview,
the loop will not get finished until you move the mouse.


If the "Apllication.ProcessMessages" are left out, the loop ends correctly.
Steps To ReproduceCall "Application.ProcessMessages" inside a loop for treeview
(See Example)
TagsNo tags attached.
Fixed in Revision59288
LazTarget-
WidgetsetQT5
Attached Files
  • project1.zip (128,591 bytes)
  • patch_34369.diff (647 bytes)
    Index: lcl/interfaces/qt5/qtobject.inc
    ===================================================================
    --- lcl/interfaces/qt5/qtobject.inc	(revision 59190)
    +++ lcl/interfaces/qt5/qtobject.inc	(working copy)
    @@ -267,7 +267,7 @@
       {we cannot call directly processEvents() with this flag
        since it produces AV's sometimes, so better check is there
        any pending event.}
    -  {$IF DEFINED(QtUseNativeEventLoop) AND DEFINED(QtCocoa)}
    +  {$IF DEFINED(QtUseNativeEventLoop) AND (DEFINED(QtCocoa) OR DEFINED(HASX11))}
       if not QCoreApplication_hasPendingEvents() then
       {$ENDIF}
         QCoreApplication_processEvents(QEventLoopWaitForMoreEvents);
    
    patch_34369.diff (647 bytes)
  • patch_34369_2.diff (550 bytes)
    Index: lcl/interfaces/qt5/qtdefines.inc
    ===================================================================
    --- lcl/interfaces/qt5/qtdefines.inc	(revision 59190)
    +++ lcl/interfaces/qt5/qtdefines.inc	(working copy)
    @@ -10,7 +10,9 @@
       {$ENDIF}
       {$DEFINE QTSCROLLABLEFORMS}
       {Qt must use native event loop at least under MacOSX cocoa 64}
    +  {$IFNDEF HASX11}
       {$DEFINE QtUseNativeEventLoop}
    +  {$ENDIF}
       {$IFDEF DARWIN}
       {enable this define if you have problems when dialogs are shown behind application}
       {.$DEFINE TQTMESSAGEBOXUSEPARENT}
    
    patch_34369_2.diff (550 bytes)
  • qtdefines.inc (816 bytes)
    {******************************************************************************
      Centralized includefile for some common qt5 defines
     ******************************************************************************}
    {$IFNDEF QTOPIA}
      {$IF DEFINED(LINUX) or DEFINED(FREEBSD) or DEFINED(NETBSD)}
        {$DEFINE HASX11}
      {$ENDIF}
      {$IF DEFINED(DARWIN) AND DEFINED(CPU64)}
      {$DEFINE QTCOCOA}
      {$ENDIF}
      {$DEFINE QTSCROLLABLEFORMS}
      {Qt must use native event loop at least under MacOSX cocoa 64}
      {$IFNDEF HASX11}
      {$DEFINE QtUseNativeEventLoop}
      {$ENDIF}
      {$IFDEF DARWIN}
      {enable this define if you have problems when dialogs are shown behind application}
      {.$DEFINE TQTMESSAGEBOXUSEPARENT}
      {$ENDIF}
      {$IFDEF HASX11}
      {.$DEFINE QtUseAccurateFrame}
      {.$DEFINE DebugQtUseAccurateFrame}
      {$ENDIF}
    {$ENDIF}
    
    qtdefines.inc (816 bytes)

Relationships

related to 0034982 closedZeljan Rikalo Appication not terminating and SigSev Error 

Activities

Reinhard Berger

2018-10-01 21:22

reporter  

project1.zip (128,591 bytes)

Anton Kavalenka

2018-10-01 22:10

reporter   ~0111172

The TTreeView has for massive updates special methods

tv.BeginUpdate;
try
  // lots of tree management
finally
  tv.EndUpdate;
end;

async updates can be done from another thread via TThread.Synchronize()

Reinhard Berger

2018-10-02 08:50

reporter   ~0111179

That is not the point.

The point is, that the application.processmessage call did not return so that the loop continues.

The call only returns when you move the mouse.

When compared to Qt4 / GTK2 this will not happen there.

Zeljan Rikalo

2018-10-02 09:52

developer   ~0111181

What is your OS ? If it's linux what theme do you use ? Please try with ./myproject -style=plastique or -style=windows and see what happens.

Reinhard Berger

2018-10-02 13:54

reporter   ~0111196

OS is Linux.
Setting the style does not make any difference.
It only completes upon moving the mouse.
Note : The mouse must be moved within the the form, outside it doesnt work too.
Currently theme is breeze, just tried oxygen and windows too without any differnce.

Reinhard Berger

2018-10-02 13:58

reporter   ~0111197

For speed comparing :

GTK2 needs around 44-40 ms for completing
Qt4 needs around 110-130 ms for completing

Zeljan Rikalo

2018-10-02 16:30

developer   ~0111206

@Reinhard: I need more details because OS Linux does not say to much.
What Linux distribution do you use (eg Ubuntu 18.04, Fedora 26 etc) + distribution version + desktop environment (eg KDE, XFCE, Cinnamon, Gnome etc)
Qt5 library version ?

Zeljan Rikalo

2018-10-02 16:36

developer   ~0111207

I can reproduce problem on Fedora 25 with Qt5-5.7.1.
About speed: application.processMessages after each iteration slows down all widgetsets.

Zeljan Rikalo

2018-10-02 16:46

developer  

patch_34369.diff (647 bytes)
Index: lcl/interfaces/qt5/qtobject.inc
===================================================================
--- lcl/interfaces/qt5/qtobject.inc	(revision 59190)
+++ lcl/interfaces/qt5/qtobject.inc	(working copy)
@@ -267,7 +267,7 @@
   {we cannot call directly processEvents() with this flag
    since it produces AV's sometimes, so better check is there
    any pending event.}
-  {$IF DEFINED(QtUseNativeEventLoop) AND DEFINED(QtCocoa)}
+  {$IF DEFINED(QtUseNativeEventLoop) AND (DEFINED(QtCocoa) OR DEFINED(HASX11))}
   if not QCoreApplication_hasPendingEvents() then
   {$ENDIF}
     QCoreApplication_processEvents(QEventLoopWaitForMoreEvents);
patch_34369.diff (647 bytes)

Zeljan Rikalo

2018-10-02 16:47

developer   ~0111209

Please test with attached patch. This patch fixes problem in my environment.

Zeljan Rikalo

2018-10-03 10:08

developer  

patch_34369_2.diff (550 bytes)
Index: lcl/interfaces/qt5/qtdefines.inc
===================================================================
--- lcl/interfaces/qt5/qtdefines.inc	(revision 59190)
+++ lcl/interfaces/qt5/qtdefines.inc	(working copy)
@@ -10,7 +10,9 @@
   {$ENDIF}
   {$DEFINE QTSCROLLABLEFORMS}
   {Qt must use native event loop at least under MacOSX cocoa 64}
+  {$IFNDEF HASX11}
   {$DEFINE QtUseNativeEventLoop}
+  {$ENDIF}
   {$IFDEF DARWIN}
   {enable this define if you have problems when dialogs are shown behind application}
   {.$DEFINE TQTMESSAGEBOXUSEPARENT}
patch_34369_2.diff (550 bytes)

Zeljan Rikalo

2018-10-03 10:08

developer   ~0111222

Or better test with 2nd patch which disables native Qt event loop under X11.

Reinhard Berger

2018-10-05 19:31

reporter   ~0111268

Sorry, did not work for me.
First i re-checked out now a new svn copy.
Re-Compiled entire Qt5 libs
Result : Not working.

Second i applied the 2nd patch
re-compiled again entire qt5 libs
Result : Still not working.

I mean with not working , that the loop does not end until i move the mouse.

Os : Linux : KUbuntu 18.04

Qt 5.9.5 (compiled against 5.9.5)

Reinhard Berger

2018-10-05 19:33

reporter   ~0111269

I attached now my qtdefines.inc after aplying the patch

Reinhard Berger

2018-10-05 19:34

reporter  

qtdefines.inc (816 bytes)
{******************************************************************************
  Centralized includefile for some common qt5 defines
 ******************************************************************************}
{$IFNDEF QTOPIA}
  {$IF DEFINED(LINUX) or DEFINED(FREEBSD) or DEFINED(NETBSD)}
    {$DEFINE HASX11}
  {$ENDIF}
  {$IF DEFINED(DARWIN) AND DEFINED(CPU64)}
  {$DEFINE QTCOCOA}
  {$ENDIF}
  {$DEFINE QTSCROLLABLEFORMS}
  {Qt must use native event loop at least under MacOSX cocoa 64}
  {$IFNDEF HASX11}
  {$DEFINE QtUseNativeEventLoop}
  {$ENDIF}
  {$IFDEF DARWIN}
  {enable this define if you have problems when dialogs are shown behind application}
  {.$DEFINE TQTMESSAGEBOXUSEPARENT}
  {$ENDIF}
  {$IFDEF HASX11}
  {.$DEFINE QtUseAccurateFrame}
  {.$DEFINE DebugQtUseAccurateFrame}
  {$ENDIF}
{$ENDIF}
qtdefines.inc (816 bytes)

Reinhard Berger

2018-10-05 20:30

reporter   ~0111270

Sorry it was my fould, patched into the wrong directory (oder svn version)

Now it works.

Time seems to be a little more as Qt4 but it works.
Thanks.

Zeljan Rikalo

2018-10-11 14:15

developer   ~0111375

Please test and close if ok.

Reinhard Berger

2018-10-18 08:23

reporter   ~0111446

works now.
thankyou

Issue History

Date Modified Username Field Change
2018-10-01 21:22 Reinhard Berger New Issue
2018-10-01 21:22 Reinhard Berger File Added: project1.zip
2018-10-01 22:10 Anton Kavalenka Note Added: 0111172
2018-10-02 08:50 Reinhard Berger Note Added: 0111179
2018-10-02 09:51 Zeljan Rikalo Assigned To => Zeljan Rikalo
2018-10-02 09:51 Zeljan Rikalo Status new => assigned
2018-10-02 09:52 Zeljan Rikalo Note Added: 0111181
2018-10-02 13:54 Reinhard Berger Note Added: 0111196
2018-10-02 13:58 Reinhard Berger Note Added: 0111197
2018-10-02 16:30 Zeljan Rikalo Note Added: 0111206
2018-10-02 16:36 Zeljan Rikalo LazTarget => -
2018-10-02 16:36 Zeljan Rikalo Note Added: 0111207
2018-10-02 16:36 Zeljan Rikalo Status assigned => confirmed
2018-10-02 16:46 Zeljan Rikalo File Added: patch_34369.diff
2018-10-02 16:47 Zeljan Rikalo Note Added: 0111209
2018-10-02 16:47 Zeljan Rikalo Status confirmed => feedback
2018-10-03 10:08 Zeljan Rikalo File Added: patch_34369_2.diff
2018-10-03 10:08 Zeljan Rikalo Note Added: 0111222
2018-10-05 19:31 Reinhard Berger Note Added: 0111268
2018-10-05 19:31 Reinhard Berger Status feedback => assigned
2018-10-05 19:33 Reinhard Berger Note Added: 0111269
2018-10-05 19:34 Reinhard Berger File Added: qtdefines.inc
2018-10-05 20:30 Reinhard Berger Note Added: 0111270
2018-10-11 14:15 Zeljan Rikalo Fixed in Revision => 59288
2018-10-11 14:15 Zeljan Rikalo Note Added: 0111375
2018-10-11 14:15 Zeljan Rikalo Status assigned => resolved
2018-10-11 14:15 Zeljan Rikalo Resolution open => fixed
2018-10-18 08:23 Reinhard Berger Note Added: 0111446
2018-10-18 08:23 Reinhard Berger Status resolved => closed
2019-02-01 13:56 Zeljan Rikalo Relationship added related to 0034982