It looks like a bug, either in glibmm or in glib.
A small but complete and compilable test program would be appreciated.
Which version of glibmm and glib do you use? Do you use Windows or a Linux distribution or what? File names with spaces are more common in Windows than in other OSes, I think.
Kjell
2014-02-06 18:41, Ian Cant skrev:
I have identified what I think might be a possible bug in gtkmm / gio where something is being incorrectly freed. I am quite new to gtkmm so I am not fully sure if this is a bug or I am using the library incorrectly.
vector<string> fileNames;Glib::RefPtr<Gio::FileEnumerator> files = this->dataSourceDir->enumerate_children(); // dataSourceDir is type: Glib::RefPtr<Gio::File>Glib::RefPtr<Gio::FileInfo> file = files->next_file();string filesName;while(file){filesName = file->get_name();if(hasEnding(filesName, ".data")){fileNames.push_back(filesName);}file = files->next_file();}
This code works correctly when enumerating over a list of files in a folder when none of the files contains a space. However if any file contains a space then an exception is thrown either at: filesName = file->get_name(); if the file is not the last in the directory or when the function returns if it is the last in the directory.
The debugger shows the issue to be around a HeapFree class in the free.c header.
I am using gtkmm-2.4 downloaded and installed from the website.
Thanks in advance for your help,
Regards.
Ian CantResearcherUniversity of Portsmouth