inotify源码:https://github.com/linuxdeepin/dde/tree/develop/app/desktop
测试代码源码:https://github.com/linuxdeepin/dde/tree/desktop_test/app/desktop/test
1. handle_rename()内存溢出
[ 19%] Testing handle_rename... ** (desktop:4431): WARNING **: Did't know file type /tmp/test_files/360wallpaper38.jpg2 ** Message: console message: file:///home/ycl/dde/resources//desktop/js/desktop.js @42: don't support type [ 19%] Testing handle_rename... ** (desktop:4431): ERROR **: Test handle_rename Failed 跟踪/断点陷阱
void handle_rename(GFile *, GFile *); Test({ GFile *old_f = g_file_new_for_path(file1); gchar *filename = g_strconcat(file1, "2", NULL); GFile *new_f = g_file_new_for_path(filename); handle_rename(old_f, new_f); g_free(filename); g_object_unref(old_f); g_object_unref(new_f); }, "handle_rename");
2、void handle_new(GFile* f);
bug同上
3、pixbuf.c中get_data_uri_by_path()中未释pixbuf
现在已释放
char* get_data_uri_by_path(const char* path) { GError *error = NULL; GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file(path, &error); if (error != NULL) { g_warning("%s\n", error->message); g_error_free(error); return NULL; } char* c = get_data_uri_by_pixbuf(pixbuf); g_object_unref(pixbuf); return c; }
4、pixbuf_to_canvas_data执行效率太低了,很慢
一个百度的logo,test 1分钟才到2%。 有待优化,里面就是用两个for循环对图像处理的
char* pixbuf_to_canvas_data(GdkPixbuf* pixbuf)