LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-23-2005, 11:19 PM   #1
stonehurstX11
Member
 
Registered: Dec 2003
Location: New Jersey, USA
Posts: 120

Rep: Reputation: 15
GTKmm and memory management


Hi, this is just a dumb question about memory management in GTKmm. I read the section regarding this topic in the GTKmm book online, but one thing still nags me.

The book states that I can let the container in which an object resides in to destroy that object using the manage() and add() methods. However, what if I do the following:

(Assume that table and aButton are members of the below class)
Code:
someClass::someClass() {
	// a Gtk::Table
	table = manage(new Gtk::Table(1, 1, false));
	
	// some button
	aButton = manage(new Gtk::Button("Test"));
	
	// attach the button to the table
	table->attach(*aButton, 0, 1, 0, 1);
	
	add(*table);

	show_all_children();
}
In this example, will the aButton widget be automatically destroyed by table when the class is destroyed? In other words, if I pack a widget created with manage() into a container using say attach() instead of add(), would that object be destroyed by the parent container?

Thanks in advance!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
memory management navaladi Mandriva 2 02-18-2005 06:47 AM
Memory management Mojojo Linux - Hardware 11 08-31-2003 10:29 AM
memory management exigent Linux - General 1 08-17-2003 08:28 PM
memory management? snow Linux - Software 7 02-12-2003 01:57 PM
Memory Management mrsolo Linux - General 7 06-26-2002 12:55 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration