9.0.2 Tuning pattern tool doesn't know active layer has switched

Description

When PCB tuning pattern tool is active, and is not tuning any tracks, just waiting the user to select a track to tune: switch the active layer, and the tuning pattern tool still tries to pick up the tracks on the previously-active layer.

Note that I'm using KiCad build from HQPCB so the build number may be a bit different from official release but I've tested with local build of master branch and the issue does exist.

Steps to reproduce

  1. Select top copper layer
  2. Press 7 to switch to length tuning tool
  3. Switch to bottom copper layer
  4. Tuning tool still tries to pick up top layer tracks

KiCad Version

Application: KiCad PCB Editor x64 on x64

Version: 9.0.2-4-g9fb8fd4174, release build

Libraries:
	wxWidgets 3.2.6
	FreeType 2.13.3
	HarfBuzz 10.2.0
	FontConfig 2.15.0
	libcurl/8.11.1-DEV Schannel zlib/1.3.1

Platform: Windows 11 (构建 26100),64位版, 64 bit, Little endian, wxMSW
OpenGL: Intel, Intel(R) Arc(TM) A770 Graphics, 4.6.0 - Build 32.0.101.6314

Build Info:
	Date: May  8 2025 10:57:45
	wxWidgets: 3.2.6 (wchar_t,wx containers)
	Boost: 1.86.0
	OCC: 7.8.1
	Curl: 8.11.1-DEV
	ngspice: 44
	Compiler: Visual C++ 1929 without C++ ABI
	KICAD_IPC_API=ON

Locale: 
	Lang: zh_CN
	Enc: UTF-8
	Num: 1,234.5
	Encoded кΩ丈: D0BACEA9E4B888 (sys), D0BACEA9E4B888 (utf8)
Edited by RigoLigoRLC