Hello everyone!
I am new to C++. I am learning GUI programming using gtkmm on linux. I have a frame class, and I have a library class (that writes data to sqlite) that belongs to that frame. How should I declare it - by pointer or reference? like -
class MyFrame : public Gtk::Window
{
public:
library * NewLibrary;
}
or
class MyFrame : public Gtk::Window
{
public:
library NewLibrary;
}
If I do it like in the first case, when I use the library's results vector<string>, say, to display database entries, when I press quit on my app there are some horrible glibc memory errors ("double free or corruption (fasttop)").
If I use the second case, everything is fine, no memory errors but it does not allow me to include a library destructor in MyFrame's destructor (causes a segmentation fault), and also it uses a bit more memory. I am afraid I might get memory leaks. What should I do?