Re: Glib::RefPtr
- From: Phil Wolff <adiabat centurylink net>
- To: gtkmm-list gnome org
- Subject: Re: Glib::RefPtr
- Date: Sun, 8 Oct 2017 07:27:06 -0700
My T_item is:
class CObject : public Glib::Object
{
public:
static Glib::RefPtr<CObject > create ( const Glib::ustring& );
virtual ~CObject ();
...
protected:
explicit CObject ( const Glib::ustring& );
private:
...
Gtk::Frame* m_pFrame;
...
};
The string argument is the name of the photo file, and the Frame
contains the display built from the information in the photo file.
Creating the model:.
m_refSpecificModel = Gio::ListStore<CObject >::create ( filename );
Binding:
m_refCurrentModel = m_refSpecificModel;
m_pFlowBox->bind_list_store ( m_refCurrentModel, ... );
All m_* variables are members of the executing class and therefore do
not go out of scope. I don't see why m_refSpecificModel's reference
count should go to 0.
When I try to re-bind the model, the CObject instances are still present
in m_refSpecificModel and the value of each m_pFrame is unchanged, but
m_pFrame->gobj () returns 0.
On 10/08/2017 06:50 AM, Daniel Boles wrote:
If you want to keep the models around, then you should keep a RefPtr
to them around, so that you hold an extra reference to stop them being
destroyed.
FlowBox should only destroy the binding, not the model itself; if the
latter occurs, it must be a result of you not having kept a reference
to the model to keep it alive.
Or did I misunderstand?
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list
--
It is better to have tried and failed than to have failed to try, but
the result's the same.
— Mike Dennison
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]