Recent

Author Topic: Error when opening the View ToDo List dialog box using a keyboard shortcut  (Read 541 times)

zoltanleo

  • Hero Member
  • *****
  • Posts: 522
Calling the dialog for viewing the available ToDo code sections using any assigned keyboard shortcut generates an error:

Code: Pascal  [Select][+][-]
  1. "Invalid type cast: TKeyCommandRelation is not a TIDEMenuCommand."

If you open the dialog via the corresponding menu item (View --> ToDo List), the error is not triggered.

I would like to propose a patch to resolve this issue.

Could someone with the appropriate permissions please take a look at this issue:
https://gitlab.com/freepascal.org/lazarus/ccr/-/work_items/39160
Win10 LTSC x64/LMDE7-x11-x86_64(gtk2/gtk3)/Fedora-44-wayland-x86_64(gtk2/gtk3)/ Kubuntu-24-x11-x86_64(qt5/qt6)/KDE Neon-wayland-x86_64(qt5/qt6)/Darwin Cocoa x86_64 (15.7.7):
Lazarus x32_64 (trunk); FPC(trunk), FireBird 5.0.3 x86_64; IBX by TonyW

Sorry for my bad English, I'm using translator ;)

jamie

  • Hero Member
  • *****
  • Posts: 7761
I tried setting a Key stroke with the Trunk here and it just didn't do anything, no errors.

maybe the trunk is built differently here to trap the code.

You could have yours built with DEBUG info.

Jamie
The only true wisdom is knowing you know nothing

zoltanleo

  • Hero Member
  • *****
  • Posts: 522
In this procedure:

Code: Pascal  [Select][+][-]
  1. procedure ViewToDoList(Sender: TObject);
  2. ...
  3. begin
  4.   ...
  5.   Pkg := PackageEditingInterface.GetPackageOfEditorItem(Sender);
  6.   if Pkg <> nil then
  7.     IDETodoWindow.ProjPack := Pkg
  8.   else begin
  9.     if ((Sender as TIDEMenuCommand).Name <> 'ViewToDoList')  // <--- here!
  10.     or (IDETodoWindow.ProjPack = nil) then
  11.       IDETodoWindow.ProjPack := LazarusIDE.ActiveProject;
  12.   end;
  13. end;

If the command is called via the menu — Sender is indeed a TIDEMenuCommand.
If the command is called via a shortcut (keyboard) — Sender is an object of type TKeyCommandRelation. This is what causes the typecast error.

The same error is reproduced in gtk2/gtk3 x11.

Win10 LTSC x64/LMDE7-x11-x86_64(gtk2/gtk3)/Fedora-44-wayland-x86_64(gtk2/gtk3)/ Kubuntu-24-x11-x86_64(qt5/qt6)/KDE Neon-wayland-x86_64(qt5/qt6)/Darwin Cocoa x86_64 (15.7.7):
Lazarus x32_64 (trunk); FPC(trunk), FireBird 5.0.3 x86_64; IBX by TonyW

Sorry for my bad English, I'm using translator ;)

jamie

  • Hero Member
  • *****
  • Posts: 7761
I just tried my normal work IDE, and it works well with 4.6

So, there must be some issues with the Tunk of 64-bit mode because my test was done with 32-bit mode just now, because that is what I have open etc.

There are other things happening with the Trunk at this time so this could be some memory flood or bleed over corrupting something if it works with other menu ID's

 This menu should not be any different than others.

 Jamie


The only true wisdom is knowing you know nothing

zoltanleo

  • Hero Member
  • *****
  • Posts: 522
I’m not going to argue. I can assume that previously the shortcut invoked a different handler, or that the logic was different. After some refactoring (from my observations, this logic was "broken" about 2–3 months ago), they apparently forgot to make this check type-safe. In any case, we were talking about the trunk version of Lazarus. To continue this discussion further, you may want to install Lazarus trunk as well. ;)
Win10 LTSC x64/LMDE7-x11-x86_64(gtk2/gtk3)/Fedora-44-wayland-x86_64(gtk2/gtk3)/ Kubuntu-24-x11-x86_64(qt5/qt6)/KDE Neon-wayland-x86_64(qt5/qt6)/Darwin Cocoa x86_64 (15.7.7):
Lazarus x32_64 (trunk); FPC(trunk), FireBird 5.0.3 x86_64; IBX by TonyW

Sorry for my bad English, I'm using translator ;)

jamie

  • Hero Member
  • *****
  • Posts: 7761
I have the trunk installed, and over here, it does not fault but simply does nothing on my windows 10-PRO PC when I define the keys for that ToDo menu.

I BUILT the Trunk as "NORMAL", you should try that and see what happens.

I have the 64-bit version operating for that, but I don't development on it because its influx all the time.

But I do know there are some other issues with it because it has some cosmetic problems where 4.6 does not have, this leads me to believe there could be some oversite somewhere in the code.

 You can have un-freed memory, and this is picked up normally using HeapTrc but other memory problems like overwriting into other zones do not get detected very well and this is where some problems appear that can be hard to find.

Lazarus is a large project, and lots can go wrong.

Jamie


The only true wisdom is knowing you know nothing

dsiders

  • Hero Member
  • *****
  • Posts: 1632
I can confirm that - using the most recent main revision on QT6 - setting a Key Mapping for the View Todo List option causes the exception to be raised. Using a toolbar  button or the View Todo List men option does not raise the exception.

I would file a bug report - but make sure you provide some information about you platform/desktop window manager in the report.

jamie

  • Hero Member
  • *****
  • Posts: 7761
I wanted to add that, although it does not fault here on my Windows-10 machine, when assigning the keys, but it does not work either. It does nothing when I use those assigned keystrokes.

  So, the problem isn't just QT, it just behaves differently with other targets.

The only true wisdom is knowing you know nothing

zoltanleo

  • Hero Member
  • *****
  • Posts: 522
I probably found a problematic commit.

Code: Bash  [Select][+][-]
  1. $ git bisect good
  2. c977938da634e4a2b0848df4a14d2eca01d0b65e is the first bad commit
  3. commit c977938da634e4a2b0848df4a14d2eca01d0b65e
  4. Author: Juha <juha@lazarus-ide.org>
  5. Date:   Sun Nov 23 09:50:44 2025 +0200
  6.  
  7.     ToDoList: Add menuitem to Project menu, too. Show in ToDoList caption the project / package info.
  8.  
  9.  components/todolist/tododlg.pas           |  45 ++++++++++++---------
  10.  components/todolist/todolist.lfm          |   4 +-
  11.  components/todolist/todolist.pas          | 147 ++++++++++++++++++++++++++------------------------------------------  components/todolist/todolistcore.pas      |   5 ++-
  12.  components/todolist/todoliststrconsts.pas |   2 +
  13.  5 files changed, 89 insertions(+), 114 deletions(-)

Now all that's left is to find someone who will fix this (let's hope Juha reads this thread :) )

The link to the issue is here:
https://gitlab.com/freepascal.org/lazarus/ccr/-/work_items/39160
« Last Edit: May 28, 2026, 02:39:47 am by zoltanleo »
Win10 LTSC x64/LMDE7-x11-x86_64(gtk2/gtk3)/Fedora-44-wayland-x86_64(gtk2/gtk3)/ Kubuntu-24-x11-x86_64(qt5/qt6)/KDE Neon-wayland-x86_64(qt5/qt6)/Darwin Cocoa x86_64 (15.7.7):
Lazarus x32_64 (trunk); FPC(trunk), FireBird 5.0.3 x86_64; IBX by TonyW

Sorry for my bad English, I'm using translator ;)

jamie

  • Hero Member
  • *****
  • Posts: 7761
I see, there are now two places with the same key-strokes. That isn't suppose to happen.

Oh well.

I wonder why he put it there in the PROJECT menu?

Jamie
The only true wisdom is knowing you know nothing

bytebites

  • Hero Member
  • *****
  • Posts: 787
May be that the bug report is in wrong section (ccr), and should be main lazarus area. If so, some one mighty might move it.

n7800

  • Hero Member
  • *****
  • Posts: 709
  • Lazarus IDE contributor
    • GitLab profile
May be that the bug report is in wrong section (ccr), and should be main lazarus area.

Of course! Luckily, I noticed this thread here ))

I mentioned the committer and asked to move the issue to the correct bug tracker.



May I ask why you decided to create an issue in this specific address "CCR"? The correct place is here: https://gitlab.com/freepascal.org/lazarus/lazarus/-/work_items

Yes, the "Lazarus" project is in the "Lazarus" subgroup. Duplication isn't a mistake, and there are reasons for it ))

By the way, the left panel of the forum has convenient "Bugtracker" links for each "Free Pascal" and "Lazarus" heading.

n7800

  • Hero Member
  • *****
  • Posts: 709
  • Lazarus IDE contributor
    • GitLab profile
I wonder why he put it there in the PROJECT menu?

As far as I understand, opening a window from the Project menu opens the to-do list items for the project, not the package. I don't know the details, as I rarely use it.

zoltanleo

  • Hero Member
  • *****
  • Posts: 522

I wonder why he put it there in the PROJECT menu?

Jamie
There is no such item in the "Project" menu. It is located in the "View" menu.
Win10 LTSC x64/LMDE7-x11-x86_64(gtk2/gtk3)/Fedora-44-wayland-x86_64(gtk2/gtk3)/ Kubuntu-24-x11-x86_64(qt5/qt6)/KDE Neon-wayland-x86_64(qt5/qt6)/Darwin Cocoa x86_64 (15.7.7):
Lazarus x32_64 (trunk); FPC(trunk), FireBird 5.0.3 x86_64; IBX by TonyW

Sorry for my bad English, I'm using translator ;)

dsiders

  • Hero Member
  • *****
  • Posts: 1632
I wonder why he put it there in the PROJECT menu?

There is no such item in the "Project" menu. It is located in the "View" menu.

Then you're not using a recent trunk.

 

TinyPortal © 2005-2018