Bail out! Gtk:ERROR:../subprojects/gtk/gtk/gtktextlinedisplaycache.c:786:gtk_text_line_display_cache_set_cursor_line: assertion failed: (cache != NULL)
I will give more detail later - sorry
This happen randomly when closing a window with delete
On Debian, C++
I try to delete the window resource from memory, not just put it invisible
→ how do we delete window in gtkmm4?
void gui_mgr::del_window(int n, bool force)
{
// delay/asynchrone manner
std::thread t(&gui_mgr::delayed_delete, this, n);
t.detach(); // Detach the thread so it runs independently
}
void gui_mgr::delayed_delete(int n)
{
std::this_thread::sleep_for(std::chrono::seconds(3)); // delay
std::lock_guard<std::mutex> lock(gui_mutex_); // LOCK
if (vwindow.contains(n))
{
Gtk::Window* p = vwindow[n]; //std::map
if (p!=nullptr)
{
delete p;
}
vwindow[n] = nullptr;
vwindow.erase(n);
}
}
void on_button_quit()
{
gui_mgr* gg = gui_mgr::get_instance("");
gg->del_window(this->_window_number, true);
}
class checkkeys_window : public Gtk::Window
{
...
}
checkkeys_window* window = new checkkeys_window(..) ;
gui_mgr* gg = gui_mgr::get_instance("");
window->_window_number = gg->window_counter;
gg->add_window(window, gg->window_counter);
gg->window_counter++;