Re: RecentInfo



On 7/31/06, Jonathon Jongsma <jonathon jongsma gmail com> wrote:
On 7/31/06, Murray Cumming <murrayc murrayc com> wrote:
> > OK, so the existing example works, but RecentManager::get_items()
> > still segfaults when trying to construct a std::vector.
>
> It works for me. I added this test code at the end of
> ExampleWindow::on_menu_file_recent_files_dialog():
>
>   typedef std::vector< Glib::RefPtr<Gtk::RecentInfo> > type_items;
>   type_items items = dialog.get_items();
>   for(type_items::iterator iter = items.begin(); iter != items.end();
> ++iter)
>   {
>     Glib::RefPtr<Gtk::RecentInfo> item = *iter;
>     if(item)
>       std::cout << "item: display_name=" << item->get_display_name() <<
> std::endl;
>   }
>
> Maybe you could post your code somewhere or check it in if appropriate.
> Then I could investigate.

Ahh, I see the problem now.  You're using RecentChooser::get_items()
and I'm using RecentManager::get_items().  RecentChooser includes the
traits specialization but the one in RecentManager does not.  I tried
to extricate the _CONVERSION() macro, ArrayHandle_RecentInfos typedef,
and RecentInfoTraits so that it could be used by both of these classes
(by putting them in recentinfo.hg, for example), but my gmmproc skills
are still quite weak, and I couldn't get it to compile in the little
time I had to work on this.  So I ended up just copying all of this
stuff from RecentChooser and duplicating it in RecentManager for now
just to make sure that it fixed my problem, and it did.

--
jonner



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]