memory leak in Gtk::Table::Attach?
Hi, My version of tkmm is 2.12.7-1 running under linux. I've created a class which has Gtk::Table container. When content of table is recreated(cells removed and attached again) there is memory leak. After 200 refreshes the leak is about 25 mb large. I'm very certain that this is gtkmm or gtk fault. I happens in Gtk::Table::Attach - when those lines are removed everything's okay. The code: Gtk::Table* Spreadsheet::getTable() { m_Entries.resize(m_Data.length()); for (int i = 0; i m_Data.length(); i++) { for (int j = 0; j m_Data.width(); j++) { Gtk::Button *b = manage(new Gtk::Button(m_Data[i][j].stringVal)); m_Entries[i].push_back(b); m_Table-attach(*b,j+1,j+2,i+1,i+2,Gtk::FILL,Gtk::FILL); } } return m_Table; } Spreadsheet::~Spreadsheet() { } void Spreadsheet::clear() { //for each is #define for_each(x,var) for(int var=0; var x.size(); var++) for_each(m_Entries,i) { for_each(m_Entries[i],j) { m_Table-remove(*m_Entries[i][j]); delete m_Entries[i][j]; } m_Entries[i].clear(); } m_Entries.clear(); } //this happens 200 times void Spreadsheet::redraw() { clear(); getTable(); m_Table-show_all(); } Thank you in advance. -- Łukasz Pełszyński ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: Using gtkmm with Visual C++ and _SECURE_SCL=0
Hallo Armin. Thanks a lot for your response. 1. In Visual-C++ the _SECURE_SCL-flag enables some special security checks within the STL-Container-templates. This means among others that the base-classes for all iterators get an additional member, a pointer to the referenced container. This pointer in turn is used to make additional runtime-checks, if an iterator is actually pointing into the container it is used with. To my opinion this is quite useful in debug-mode, but for release-versions, these checks can easily slow down the performance of programs by 10-20% and more, depending on the algorithms used. Since _SECURE_SCL=0 removes the additional pointer-member from the iterators, the binary-compatiblility with libraries in 'secure-mode' is broken. Anyway. MS has decided to make _SECURE_SCL=1 the default, for both release- and debug-mode. Which leads me to... 2. I totally agree with pre-built libraries compiled with the default-settings of a compiler. I did not really expect an additional customized build for my purposes. That's why I asked for a known workaround. It could be that sigc++ is the only source of problems, since it exchanges iterators in its interface (signal::connect()). If so, I would mail to their list, but I do not really know if there is other items somewhere in the libraries that are also affected and I cannot double-check the complete code... 3. I found the instructions on http://live.gnome.org/gtkmm/MSWindows/BuildingGtkmm . But I would rather like to rebuild exactly the libs and dlls, that come with the installer-packages. Where can I find out, which packages of libsigc++ ftp://ftp.gnome.org/pub/GNOME/sources/libsigc++, glibmm ftp://ftp.gnome.org/pub/GNOME/sources/glibmm, cairomm http://cairographics.org/releases/, pangomm ftp://ftp.gnome.org/pub/GNOME/sources/pangomm and gtkmm ftp://ftp.gnome.org/pub/GNOME/sources/gtkmm were exactly used for the installers? The idea is, if I rebuild exactly the same versions, I could just exchange the release-libs and -dlls of the standard gtkmm-installation and are finished. Maybe there is even a complete VisualC++-Workspace (sln) for all C++-libraries at once, that could be released along with the installers? Any aid in building a 'patch' for the installers would be welcome. regards Thomas Armin Burgmeier wrote: I didn't even know this option existed. Of course, we could enable this for the gtkmm runtime binaries, but then people need to set the same flag in their applications, which is just one step more that could go wrong. This is why I would rather avoid it. We could also supply release binaries for both _SECURE_SCL=0 and _SECURE_SCL=1 (so we would have 6 different VC++ DLLs for each C++ module). Again, I'm not quite happy with this considering the duplication it involves. How many applications do (need to) use the _SECURE_SCL=0 option? Is it kind of standard that it is used for release builds? If not, then I'm sorry, but I don't think it's reasonable to support all the different MSVC++ compiler settings that produce incompatible binaries. Just because there are too much of them. However, considering the rules posted on [1], I don't see an easy workaround for your problem without rebuilding the involved C++ libraries. Armin [1] http://blogs.msdn.com/vcblog/archive/2007/08/10/the-future-of-the-c-language.aspx#4617984 ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
TreeModelFilter as LIST_ONLY
Hi, recently i ask something about to set the model of a iconview from a treemodelfilter with a filter and a path that only has 1 depth children, so it look like a list, but iconview complain for the LIST_ONLY flag, how can i create a new treemodelfilter class but that return a LIST_ONLY flag and define a filter that only show the children with no childrens. I need some help on this, i was trying to solve it myself, but i need more experience on c++ and gtk. -- Jorge Eduardo Cardona [EMAIL PROTECTED] jorgeecardona.blogspot.com Linux registered user #391186 Registered machine#291871 ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: TreeModelFilter as LIST_ONLY
Jorge Cardona said the following: Hi, recently i ask something about to set the model of a iconview from a treemodelfilter with a filter and a path that only has 1 depth children, so it look like a list, but iconview complain for the LIST_ONLY flag, how can i create a new treemodelfilter class but that return a LIST_ONLY flag and define a filter that only show the children with no childrens. I need some help on this, i was trying to solve it myself, but i need more experience on c++ and gtk. The problem is that a Gtk::TreeModelFilter only wraps over the actual Gtk::TreeModel, but it is still only the underlying Gtk::TreeModel underneath. Getting the flags of the Gtk::TreeModelFilter is equivalent to getting the flags of the underlying Gtk::TreeModel. A Gtk::TreeStore's rows can have children and is therefore not usable by a Gtk::IconView. You really need to use a Gtk::ListStore with the Gtk::IconView. -- José Alburquerque ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Fwd: TreeModelFilter as LIST_ONLY
2008/10/22 José Alburquerque [EMAIL PROTECTED]: Jorge Cardona said the following: Hi, recently i ask something about to set the model of a iconview from a treemodelfilter with a filter and a path that only has 1 depth children, so it look like a list, but iconview complain for the LIST_ONLY flag, how can i create a new treemodelfilter class but that return a LIST_ONLY flag and define a filter that only show the children with no childrens. I need some help on this, i was trying to solve it myself, but i need more experience on c++ and gtk. The problem is that a Gtk::TreeModelFilter only wraps over the actual Gtk::TreeModel, but it is still only the underlying Gtk::TreeModel underneath. Getting the flags of the Gtk::TreeModelFilter is equivalent to getting the flags of the underlying Gtk::TreeModel. A Gtk::TreeStore's rows can have children and is therefore not usable by a Gtk::IconView. You really need to use a Gtk::ListStore with the Gtk::IconView. Yes, I know that, but i don't want to duplicate data, and i need to store all my data on an treestore, it should be easy to create a filter that let show only the elements with no children, with that a treemodelfilter works like it has a liststore as model, but it is also needed the LIST_ONLY flag for the iconview. I was thinking in create a new class that inherits from a Gtk::TreeModelFilter, but i can't override the get_flags method -- José Alburquerque -- Jorge Eduardo Cardona [EMAIL PROTECTED] jorgeecardona.blogspot.com Linux registered user #391186 Registered machine#291871 ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list
Re: TreeModelFilter as LIST_ONLY
Jorge Cardona said the following: 2008/10/22 José Alburquerque [EMAIL PROTECTED]: Jorge Cardona said the following: Hi, recently i ask something about to set the model of a iconview from a treemodelfilter with a filter and a path that only has 1 depth children, so it look like a list, but iconview complain for the LIST_ONLY flag, how can i create a new treemodelfilter class but that return a LIST_ONLY flag and define a filter that only show the children with no childrens. I need some help on this, i was trying to solve it myself, but i need more experience on c++ and gtk. The problem is that a Gtk::TreeModelFilter only wraps over the actual Gtk::TreeModel, but it is still only the underlying Gtk::TreeModel underneath. Getting the flags of the Gtk::TreeModelFilter is equivalent to getting the flags of the underlying Gtk::TreeModel. A Gtk::TreeStore's rows can have children and is therefore not usable by a Gtk::IconView. You really need to use a Gtk::ListStore with the Gtk::IconView. Yes, I know that, but i don't want to duplicate data, and i need to store all my data on an treestore, it should be easy to create a filter that let show only the elements with no children, with that a treemodelfilter works like it has a liststore as model, but it is also needed the LIST_ONLY flag for the iconview. I was thinking in create a new class that inherits from a Gtk::TreeModelFilter, but i can't override the get_flags method I see. I'm not sure what your results would be and I wont tell you that I know exactly what you need to do to achieve this, but I think you should look into Gtk::TreeModel from which Gtk::TreeModelFilter derives and see if you can achieve what your trying to do that way. -- José Alburquerque ___ gtkmm-list mailing list gtkmm-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtkmm-list