Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / qt / 2007-07

Some changes cause errors in qt ide under win32

8 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Paul Ishenin

Hello, Items specific to the Qt widget set.

After some changes I have this errors while running qt ide:

E:\lazarus\lazarus>E:\lazarus\mingw\bin\gdb.exe lazarus.exe GNU gdb 6.0
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i686-pc-mingw32"...
(gdb) r
Starting program: E:\lazarus\lazarus/lazarus.exe
TApplication.IconChanged - TODO: convert this message...no implementation in gtk or win32
NOTE: help options config file not found - using defaults TMainIDE.DoLoadLFM A
E:\lazarus\laz_svn\pathes\spdbutton_actmngr\Unit1.pas IsPartOfProject=True SUCCESS: streaming
lfm="E:\lazarus\laz_svn\pathes\spdbutton_actmngr\Unit1.lfm" TMainIDE.DoLoadLFM there is no LFM file for
"E:\lazarus\lazarus\lcl\interfaces\qt\qtcaret.pas" TMainIDE.DoLoadLFM there is no LFM file for
"E:\lazarus\lazarus\lcl\buttons.pp"
TMainIDE.DoLoadLFM there is no LFM file for
"E:\lazarus\lazarus\lcl\interfaces\qt\qtthemes.pas" TMainIDE.DoLoadLFM there is no LFM file for
"E:\lazarus\lazarus\lcl\interfaces\qt\qt43.pas"
TMainIDE.DoLoadLFM there is no LFM file for
"E:\lazarus\lazarus\lcl\interfaces\qt\qtwidgets.pas" QPainter::begin: Widget painting can only begin as a result of a paintEvent QPainter::begin: Widget painting can only begin as a result of a paintEvent

Program received signal SIGSEGV, Segmentation fault. $6510acbf in ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent () from E:\Qt\4.3.0\bin\QtGui4.dll
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault. $6510acbf in ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent () from E:\Qt\4.3.0\bin\QtGui4.dll
(gdb) c
Continuing.

Program exited with code 030000000005.
(gdb)

Any ideas?

I had no such
Best regards,
Paul Ishenin.

zeljko
to Paul Ishenin
Paul Ishenin wrote
Hello, Items specific to the Qt widget set. After some changes I have this errors while running qt ide:

I see also QApplication_notifyhelper() AV's when try to click an item in TTreeView (qt). Don't know what could it be, there were a lot of changes last days, but not sure if those changes are real problem.

Paul Ishenin
to zeljko
zeljko wrote 9 lines
On Monday 16 July 2007 08:17, Paul Ishenin wrote: > Hello, Items specific to the Qt widget set. > > After some changes I have this errors while running qt ide: > I see also QApplication_notifyhelper() AV's when try to click an item in TTreeView (qt). Don't know what could it be, there were a lot of changes last days, but not sure if those changes are real problem.

yes, you are right ;) but it is your Timer rapairing indirectly breaks ide. problem ofcource not in timer - now it works as it should and as result trigger events that case exceptions in qt.

To be more exact: out TTreeView has FChangeTimer with interval = 1 which is used when selection is changed. IDE has TreeView component TheControlSelection and TMainIDE.OnControlSelectionChanged executed on timer. So problem somewhere in TMainIDE.OnControlSelectionChanged calls.

I will try to dig depper.

Best regards,
Paul Ishenin.

Paul Ishenin
to Paul Ishenin
Paul Ishenin wrote 20 lines
zeljko wrote: > On Monday 16 July 2007 08:17, Paul Ishenin wrote: >> Hello, Items specific to the Qt widget set. >> >> After some changes I have this errors while running qt ide: >> > I see also QApplication_notifyhelper() AV's when try to click an item in > TTreeView (qt). Don't know what could it be, there were a lot of changes last > days, but not sure if those changes are real problem. yes, you are right ;) but it is your Timer rapairing indirectly breaks ide. problem ofcource not in timer - now it works as it should and as result trigger events that case exceptions in qt. To be more exact: out TTreeView has FChangeTimer with interval = 1 which is used when selection is changed. IDE has TreeView component TheControlSelection and TMainIDE.OnControlSelectionChanged executed on timer. So problem somewhere in TMainIDE.OnControlSelectionChanged calls. I will try to dig depper.

I've found offender! It is THintWindow. I changed Qt code a bit to let LCL activate its internal hint mechanism. And while showing any hint I get this SISIGV. I suspected hint window before, but now I have arguments :)

To repeat exception you need to:
1. Add TPanel to form (or something else)
2. Set hint to "blabla", Set ShowHint to True
3. Run application and move mouse over panel
4. After showing that "blabla" we get SISIGV

Everybody wellcome to thurther investigation.

Best regards,
Paul Ishenin.

zeljko
to Paul Ishenin
Paul Ishenin wrote 8 lines
Paul Ishenin wrote: To repeat exception you need to: 1. Add TPanel to form (or something else) 2. Set hint to "blabla", Set ShowHint to True 3. Run application and move mouse over panel 4. After showing that "blabla" we get SISIGV Everybody wellcome to thurther investigation.

wow, THintWindow was first bug fixed by me in qt3CLX port, few years ago ;)

Paul Ishenin
to zeljko

zeljko ?????:

Show quoted text 11 lines
On Wednesday 18 July 2007 07:47, Paul Ishenin wrote: > Paul Ishenin wrote: > To repeat exception you need to: > 1. Add TPanel to form (or something else) > 2. Set hint to "blabla", Set ShowHint to True > 3. Run application and move mouse over panel > 4. After showing that "blabla" we get SISIGV > > Everybody wellcome to thurther investigation. wow, THintWindow was first bug fixed by me in qt3CLX port, few years ago ;)

I created separate class for THintWindow - TQtHintWindow (probably temporary - for debug purposes)

So, what I digged for now:

1. THintWindow.CalcHintRect raises Qt warnings something like "it is dangerous to leave active Painters outside paint event" (typed from memory). To be more exact DrawText with DT_CALCRECT is guilty for this.

2. I added line

   Result := Format('Unknown event: %d', [QEvent_type(Event)]);

to EventTypeToStr debug function. And after that catched unknown events 70 and 67 - they are defined only fot QT_3 support. So I think our bindings are compiled with Qt3 support. Do we need this? Can we remove it?

3. If I comment DrawText in THintWindow then I can catch much more events related to THintWindow widget. Without commenting I catch exception in next event after PaintEvent.

So, it is something related with using painting routines ouside paint event. I dont know how to solve that painting. We have many places in LCL where we can write such code:

   DC := GetDC()
   BitBlt(DC, ...)
   ReleaseDC(DC)

And now we have restriction that all this is possible only in paint events. How to move this code to paintevent????

Best regards,
Paul Ishenin.

zeljko
to Paul Ishenin
Paul Ishenin wrote
zeljko ?????: 1. THintWindow.CalcHintRect raises Qt warnings something like "it is dangerous to leave active Painters outside paint event" (typed from memory). To be more exact DrawText with DT_CALCRECT is guilty for this.

problem is down :)

Show quoted text 5 lines
2. I added line Result := Format('Unknown event: %d', [QEvent_type(Event)]); to EventTypeToStr debug function. And after that catched unknown events 70 and 67 - they are defined only fot QT_3 support. So I think our bindings are compiled with Qt3 support. Do we need this? Can we remove it?

No, bindings are not compiled with Qt3 support, but your's qt4 libs could be, or qt4 libs sends those events, just because nobody cares about it (a bug in qt4 ?).

Show quoted text 15 lines
3. If I comment DrawText in THintWindow then I can catch much more events related to THintWindow widget. Without commenting I catch exception in next event after PaintEvent. So, it is something related with using painting routines ouside paint event. I dont know how to solve that painting. We have many places in LCL where we can write such code: DC := GetDC() BitBlt(DC, ...) ReleaseDC(DC) And now we have restriction that all this is possible only in paint events. How to move this code to paintevent????

All widgets have to be painted inside paint event, but eg. pixmaps NOT. So it depends on defined QPaintDevice->devType().

Paul Ishenin
to Paul Ishenin: I've found offender! It is THintWindow. I changed Qt code a bit to let LCL activate its…
Show quoted text 9 lines
Paul Ishenin wrote: To repeat exception you need to: 1. Add TPanel to form (or something else) 2. Set hint to "blabla", Set ShowHint to True 3. Run application and move mouse over panel 4. After showing that "blabla" we get SISIGV Everybody wellcome to thurther investigation.

Fixed.

Problem was in EventFilter of Timer function and now I think that most of EventFilters have similar bugs.

   if QEvent_type(Event) = QEventTimer then
   begin
     Result := True; <- this line fix crashes

Now quotation from qt documentation:

In your reimplementation of this function, if you want to filter the event out, i.e. stop it being handled further, return true; otherwise return false.

and later:

Warning: If you delete the receiver object in this function, be sure to return true. Otherwise, Qt will forward the event to the deleted object and the program might crash.

It is usual situation that timer is deleted on timer event. And so with any event that passed to LCL. In event handling code widget that call event can be destroyed.

I think now that we must return True in any case of passing event to LCL.

What do you think?

Best regards,
Paul Ishenin.