wxMaxima
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
test_LastActiveTextCtrl.cpp File Reference

Regression test for BTextCtrl::LastActive(), the "which text control gets the sidebar symbols?" tracking. More...

#include <wx/app.h>
#include <wx/bitmap.h>
#include <wx/dcmemory.h>
#include <wx/frame.h>
#include <wx/log.h>
#include "BTextCtrl.h"
#include "Configuration.h"
#include <cstdlib>
#include <unistd.h>
#include <catch2/catch.hpp>
Include dependency graph for test_LastActiveTextCtrl.cpp:

Data Structures

class  TestApp
 

Functions

 wxDECLARE_APP (TestApp)
 
 SCENARIO ("A focused text control registers itself as the symbol target")
 
 SCENARIO ("A destroyed text control cannot stay the symbol target")
 
int main (int argc, char **argv)
 

Detailed Description

Regression test for BTextCtrl::LastActive(), the "which text control gets the sidebar symbols?" tracking.

It used to be a raw wxTextCtrl* inside Configuration and BTextCtrl's destructor could not unregister itself (the Configuration object dies first on some platforms, issue #2027) – so closing a wizard whose field had the focus left a dangling pointer that Worksheet::OnSidebarKey() would write into and SetFocus() on: a use-after-free. The tracking is now a wxWeakRef-backed static on BTextCtrl itself; this drives a real BTextCtrl and checks the reference nulls itself when the control is destroyed.