shutdown g_io_channel之后,仍旧会有event发送
来源:互联网 发布:花旗软件待遇 编辑:程序博客网 时间:2024/04/28 06:19
Re: GIOFunc called after a g_io_channel_shutdown
- From: Tristan Van Berkom <tvb gnome org>
- To: Renaud Malaval <Renaud Malaval palmsource com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: GIOFunc called after a g_io_channel_shutdown
- Date: Tue, 16 May 2006 13:14:38 -0400
Renaud Malaval wrote:
Hello,
I use g_io_channel_unix_new() in a custom dialog to check somes ioevents.I close my gioChannel in the foo_dialog_response_cb(), just beforedestroy the custom dialog.
To close the gioChannel I Does :
status = g_io_channel_shutdown(privP->gioChannelP, FALSE, &gerrorP); if( gerrorP) {g_error_free(gerrorP);}g_io_channel_unref(privP->gioChannelP);
I don't have errors (status is ok and no gerrorP) About 1 or 2 seconds
after that my GIOFunc callback is called and crash because of bad
context (user_data pointer is breaked)I don't understood why the gioChannel is not closed.
Any idea, please ?
The GIOWatch has a reference to the channel, so unreffing the channelwill not destroy it untill the GIOWatch source has been destroyed...calling g_io_channel_shutdown(); depending on the file type and whatevents you are watching... may trigger an event on the fd (a hangupdetected ? or and EOF maybe ?)
Typicly... in very simple situations I do something like this:========================================================channel = channel_new (probably _unix_new with an fd);source_id = g_io_add_watch (channel ... args);g_io_channel_unref (channel); // pass ownership of the channel to the watch
/* ...now later... when shutting down I do: */g_source_remove (source_id); // this will remove the event source and unreff the channel.========================================================
Cheers, -Tristang_io_channel_shutdown ()GIOStatus g_io_channel_shutdown (GIOChannel *channel, gboolean flush, GError **err);Close an IO channel. Any pending data to be written will be flushed if flush is TRUE. The channel will not be freed until the last reference is dropped using g_io_channel_unref().channel : a GIOChannelflush : if TRUE, flush pendingerr : location to store a GIOChannelErrorReturns :the status of the operation.
- shutdown g_io_channel之后,仍旧会有event发送
- 序列化有event的类会是什么效果?
- [原创]关闭Shutdown Event Tracker功能
- Alert! Previous shutdown due to thermal event
- Android串口通讯,在线程里一直监听是否有消息发来,接收到消息到runOnUiThread处理跳转页面,页面跳转关闭之后,在发送消息尽然还会执行在打开页面?
- 总结一下到底有多少event会促使DBWR将数据写入Disk
- CVTE宣讲会之后
- 在安装上.NET 2003 Framework 之后,调试有时侯会错误,
- 自控力 笔记4 容忍罪恶:为何善行之后会有恶行
- 自控力之容忍罪恶:为何善行之后会有恶行
- 加载对话框背景图片,代码如下,可是为什么对话框最大化之后,会有重叠?
- li在IE6中固定li的高度之后还是会有2px下间距
- 自控力读书笔记 第四章 容忍罪恶: 为何善行之后会有恶行
- 使用jstl写的jsp生成之后查看源代码会看到头部有很多空行
- 对话框里面有EdiText,而EdiText获取焦点之后,软件盘会盖住对话框,解决问题
- 去掉UITableViewCell左侧会有默认15像素的空白,ios8之后新的解决方法
- iOS8.0 UILabel切圆角之后有时边缘会有一条黑线
- PHP 图片 保持高宽不变压缩之后imagejpeg($source,$file,100) 仍旧失真!
- Javascript cookies
- 视图上创建索引
- 存储过程中游标带参数
- yii模版中的写法
- JAVA关键字具体的作用和用法
- shutdown g_io_channel之后,仍旧会有event发送
- 解决Visual Studio 2010 无智能提示感知的方法
- NS-3 Develop Tools
- Ackermann数
- Objective-C 语法的那些事儿
- tomcat安装
- Linux下编译C程序
- 关于PL/SQL代码中的内嵌SQL与V$SQL的关系
- ondraw() 和dispatchdraw()的区别 .