|
|
(gdb) backtrace #0 0x00007ffff7ed7bd0 in Fl_Input_::static_value(char const*, int) () from /usr/lib/libfltk.so.1.3 #1 0x00007ffff7ed7da1 in Fl_Input_::value(char const*, int) () from /usr/lib/libfltk.so.1.3 #2 0x000055555555a393 in Graph_lib::Out_box::put (this=0x7fffffffdfe0, s="Point: (1, 2)\nradius: 3") at GUI.cpp:46 #3 0x000055555556d1f1 in Graph_lib::Item_window::set_clb (this=0x7fffffffdc00) at My_window.cpp:308 #4 0x000055555556c0d0 in Graph_lib::Item_window::<lambda(Graph_lib::Address, Graph_lib::Address)>::operator()(Graph_lib::Address, Graph_lib::Address) const (__closure=0x0, pw=0x7fffffffdc00) at My_window.cpp:215 #5 0x000055555556c0f8 in Graph_lib::Item_window::<lambda(Graph_lib::Address, Graph_lib::Address)>::_FUN(Graph_lib::Address, Graph_lib::Address) () at My_window.cpp:215 #6 0x00007ffff7f08872 in Fl_Widget::do_callback(Fl_Widget*, void*) () from /usr/lib/libfltk.so.1.3 #7 0x00007ffff7eb8bf5 in Fl_Button::handle(int) () from /usr/lib/libfltk.so.1.3 #8 0x00007ffff7eb0a8a in ?? () from /usr/lib/libfltk.so.1.3 #9 0x00007ffff7eb296e in Fl::handle_(int, Fl_Window*) () from /usr/lib/libfltk.so.1.3 #10 0x00007ffff7f0f96b in fl_handle(_XEvent const&) () from /usr/lib/libfltk.so.1.3 #11 0x00007ffff7f11206 in ?? () from /usr/lib/libfltk.so.1.3 #12 0x00007ffff7f11522 in fl_wait(double) () from /usr/lib/libfltk.so.1.3 #13 0x00007ffff7eb22d6 in Fl::wait(double) () from /usr/lib/libfltk.so.1.3 #14 0x00007ffff7eb23de in Fl::run() () from /usr/lib/libfltk.so.1.3 #15 0x000055555557001e in Graph_lib::gui_main () at Window.cpp:69 #16 0x0000555555559808 in main () at C16E04_main.cpp:9 |
|
|
|
|
attach(cl_button);
, you are not dereferencing a pointer or allocating memory dynamicallyrunning through gdb |
so it seems that's a problem with `message_box' looking at the `Item_window' constructor, you didn't `attach()' `message_box' (whatever that is) |
by the way, this smells like memory leak 1 2 3 4 5 6 7 void Item_window::add_circle() { Circle *new_cl = new Circle{ cl_p, cl_r }; pos_button.hide(); attach(*new_cl); redraw(); } because in the constructor you simply do attach(cl_button);, you are not dereferencing a pointer or allocating memory dynamically ¿so how's going to delete that memory? |
|
|
t = new tab(url);
that would reserve (new
) enough memory to store all the text and images from the web page.delete
) that memory so other programs may use it. Suppose that you fail to do so, then after some hours/days of use, your web browser may is eating gigas of memory but perhaps you are only showing a blank page.window.add_widget(new Button("Yes"));
because `window' has the responsibility of releasing that memory.attach(*new_cl);
was kind of weird so it tingled my vinyl little antennas
|
|
|
|
|
|
gdb is a debugger, a wonderful tool used to fix runtime and logic errors when your program crashes it will stop the execution, showing the line where it happened and the path it took to get there (the backtrace), then you may inspect variables to see erroneous values. another good tool is valgrind, it's easier to detect invalid access (invalid pointers, out of bounds errors) and bad memory management (double delete, memory leak) |
now another issue, dangling references lets say that you instead do
when `add_circle()' ends, new_cl is destroyed because it ends its scope |
ja.. found some code in GUI.h, class Menu
|