Re: Gtk::TreeView
- From: Christopher Raine <c raine gmx net>
- To: gtkmm-list gnome org
- Subject: Re: Gtk::TreeView
- Date: Tue, 19 Dec 2006 09:21:09 +0100
Vladimir,
I just compiled and tested both programs that Paul sent without
problems.
The _BLOCK_TYPE_IS_VALID(pHead->nBlockUse) assertion can get fired
for several reasons. Either memory is getting freed twice, heap/stack
corruption has occured or two(or more) different types of the win32
runtime libraries are been used. In the last case you are not allowed
to free memory in a dll/exe that has been allocated in another dll/
exe if you are not using the DLL versions of the runtime libraries.
Are you linking against the Multithreaded-DLL-Debug version of the
runtime libraries?
regards,
Christopher Raine
On Dec 18, 2006, at 10:39 PM, Vladimir Đokić wrote:
Hi all,
Just ran your code Paul (just test.cc), and still the same error
when deleting mWindow (_BLOCK_TYPE_IS_VALID(pHead->nBlockUse);).
Thank you for all your help,
Vladimir.
On 12/18/06, Paul Davis <pjdavis engineering uiowa edu> wrote:
Vladimir,
I've attached two files. They're both essentially the same thing that
you pasted, but changed a bit to make them compile without the rest of
your code.
Try compiling and running them and let me know if they produce the
errors you're getting with your code.
better.cc is the same program implemented slightly differently using
stack allocation and inheritance. Both being 'Good Things (TM)' in
this case.
Paul
On 12/18/06, Vladimir Đokić <v djokic gmail com> wrote:
> Hi all,
>
> Here's the code snip (from various files):
>
> int main(int argc, char* argv[])
> {
> Gtk::Main kit(argc, argv);
>
> u1::Editor* editor = new u1::Editor();
> editor->Init();
>
> Gtk::Main::run(editor->GetWindow());
>
> delete editor;
>
> return 0;
> }
>
> class Editor
> {
> public:
> Editor()
> : mWindow(NULL)
> { /* void */ }
>
> ~Editor()
> { delete mWindow; }
>
> void Init()
> {
> ...
>
> Glib::RefPtr<Gnome::Glade::Xml> xml =
> Gnome::Glade::Xml::create("Ui/u1Editor.glade");
> xml->get_widget("u1Window", mWindow);
>
> ...
> Gtk::TreeView* tree_view = NULL;
> xml->get_widget("u1TreeView", tree_view);
>
> mTreeModel = Gtk::TreeStore::create(mTreeColumns);
> tree_view->set_model(mTreeModel);
>
> Gtk::TreeModel::Row row = *(mTreeModel->append());
> row[mTreeColumns.mNodeName] = "Root";
>
> tree_view.append_column("Nodes",
> mTreeColumns.mNodeName );
> }
>
> private:
> void OnQuit() // <-- executed from menu bar
> {
> Gtk::Main::quit();
> }
>
> class TreeColumns : public Gtk::TreeModel::ColumnRecord
> {
> public:
>
> ModelColumns()
> { add(mNodeName); }
>
> Gtk::TreeModelColumn<Glib::ustring> mNodeName;
> };
>
> TreeColumn mTreeColumns;
> Glib::RefPtr<Gtk::TreeStore> mTreeModel;
>
> Gtk::Window* mWindow;
>
> };
>
>
>
> Hope this will make more sense,
>
> Vladimir.
>
>
> On 12/18/06, Vladimir Đokić <v djokic gmail com > wrote:
> > Hi all,
> >
> > Unfortunately, since I'm using binary distribution of gtkmm,
I'm unable to
> step into destruction of Gtk::Window. I've just noticed that I'm
using
> Multithreaded Debug DLL (and don't know how gtkmm on windows was
built), so
> I'll try changing these values... I'll post code later, when I
get home
> (thought the code follows documentation and examples).
> >
> >
> >
> > Thanks,
> >
> > Vladimir.
> >
> >
> > On 12/18/06, Paul Davis < pjdavis engineering uiowa edu> wrote:
> > > Vladimir,
> > >
> > > Could you paste the tree view code you're using.
> > >
> > > And what is the heap message? I don't know much about Visual
Studio,
> > > so if this is some standard error I can only assume its the
equivalent
> > > of a segfault.
> > >
> > > Does Visual Studio have a debugger so you can see which line is
> > > causing this error?
> > >
> > > Paul
> > >
> > > On 12/18/06, Vladimir Đokić < v djokic gmail com> wrote:
> > > > Hi all,
> > > >
> > > > I'm loading everything but the treemodel from the .glade
file using
> > > > libglademm. For the creation of model and model data
columns I'm using
> > > > example code from the gtkmm book. The window pointer I'm
getting is
> valid
> > > > (points to Gtk::Window data) as well as the treeview
pointer (but I'm
> only
> > > > deleting window, since all other widgets are managed and
will be
> deleted as
> > > > children of window). I also noticed that nodes are showing
some bad
> > > > behavior: Only last node is shown as root (top), and the
when I click
> to
> > > > expand the node, nothing shows (empty). The binaries of
gtkmm are from
> > > > http://www.pcpm.ucl.ac.be/~gustin/win32_ports/. I've
> double
> > > > checked the code. When the deletion of window occurs the
heap error
> message
> > > > is issued by the visual studio. In the end, I can cook up
small
> example of
> > > > this - if needed.
> > > >
> > > > Thanks,
> > > >
> > > > Vladimir.
> > > >
> > > > On 12/18/06, Paul Davis < pjdavis engineering uiowa edu>
wrote:
> > > > > Vladimir,
> > > > >
> > > > > Could you be a tad bit more specific on the problem
you're having?
> > > > >
> > > > > Paul
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > >
> > > > "There's no room for ideals in this mechanical place. There
has to be
> > > > passion. "
> > > > _______________________________________________
> > > > gtkmm-list mailing list
> > > > gtkmm-list gnome org
> > > > http://mail.gnome.org/mailman/listinfo/gtkmm-list
> > > >
> > > >
> > > >
> > >
> >
> >
> >
> > --
> >
> > "There's no room for ideals in this mechanical place. There has
to be
> passion. "
>
>
>
> --
>
> "There's no room for ideals in this mechanical place. There has
to be
> passion. "
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>
>
>
--
"There's no room for ideals in this mechanical place. There has to
be passion. "
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]