RE: [gtk-list] entry problem





> -----Original Message-----
> From: mailaxe@263.net [mailto:mailaxe@263.net]
> Sent: Monday, December 13, 1999 9:00 AM
> To: gtk-list@redhat.com
> Subject: [gtk-list] entry problem
> 
> 
> Good afternoon!
> 
> I have some questions - they may not be considered as gtk problems. 
> When I use entry in a dialog box for user to input something,I can
> get the text out by calling gtk_entry_get_text(). And there is another
> function can be called according to the reference gtk_editable_get_
> chars(). The difference between these two functions is that one
> should never be released using g_free(), but the other can. I am 
> using the first one as follow:
> 
> gchar *buf;
> 
> buf = gtk_entry_get_text();
> 
> So, here comes my question:
> 1. whether or not it is required that I allocate some memory to "buf" 
> using g_malloc().

No good question. This function returns a pointer, so allocating memory yourself will result in a leak.

> 2. If g_malloc() is required, then can I release "buf" using g_free();


> 3. I don't know where is my bug, my program results in "CORE DUMPED" 
> from time to time.

you should not free buf.

Take a look at the API reference at
http://developer.gnome.org/doc/API/gtk/index.html

regards,

Arjan

> thanks!
>                                 mailaxe
> 
> 
> _____________________________________________
> 首都在线--先进中国人的网上家园 http://www.263.net
> 免费邮箱 邮件杂志 签名邮件 邮件加密 邮件追身呼
> 搜索引擎 个人站点 在线游戏 网上聊天 网上挂号
> 金融王国 在线杀毒 跳蚤市场 软件下载 休闲娱乐
> 诺方安全,助您e路平安
> 
> -- 
> To unsubscribe: mail -s unsubscribe 
> gtk-list-request@redhat.com < /dev/null
> 



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