After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 401083 - Async API example
Async API example
Status: RESOLVED FIXED
Product: gnome-vfsmm
Classification: Deprecated
Component: general
git master
Other Linux
: Normal enhancement
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2007-01-26 18:15 UTC by Marko Anastasov
Modified: 2011-01-16 23:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch and example files (3.07 KB, application/x-compressed-tar)
2007-01-26 18:19 UTC, Marko Anastasov
  Details
extended example (14.97 KB, patch)
2007-01-29 13:50 UTC, Marko Anastasov
none Details | Review
extended example, with CL entry (15.43 KB, patch)
2007-01-29 13:53 UTC, Marko Anastasov
none Details | Review

Description Marko Anastasov 2007-01-26 18:15:38 UTC
While learning about and writing an example of using the asynchronous operations, I got stuck pretty quickly. The "example" so far is very simple, it tries to open and read a file passed as a program argument. The inspiration comes from the C test test-async.c found in gnome-vfs/tests. My goal is to have an example for transfers eventually.

What I see is that here the SignalProxy_AsyncOpen::c_callback() function is never called after open() on an Async2::Handle is executed. So far I couldn't really follow further. I'll attach the code.
Comment 1 Marko Anastasov 2007-01-26 18:19:04 UTC
Created attachment 81281 [details]
patch and example files

In async-handle-2.hg I added Priority enum, defining the three priorities as in the C header. I've kept main.cc simple, even without calling close() before this is resolved.
Comment 2 Murray Cumming 2007-01-28 15:59:07 UTC
By the way, I noticed that I have not done any gnome-vfsmm 2.17.x tarball release, so we have actually missed the API freeze for GNOME 2.18. Sorry. Is this very inconvenient for you?
Comment 3 Murray Cumming 2007-01-28 16:34:16 UTC
I have committed the patch anyway, though I 
- removed the debug comments.
- moved the Priority enum into Gnome::Vfs::Async2::Handle. Tell me if this doesn't make sense.
- Added documentation for the enum items, from the C documentation.
- In the example, removed the return type from print_vfs_error().

I have not investigated the problem yet. Is it possible that "delete handle" is being called too soon?
Comment 4 Marko Anastasov 2007-01-28 22:38:29 UTC
(In reply to comment #2)
> By the way, I noticed that I have not done any gnome-vfsmm 2.17.x tarball
> release, so we have actually missed the API freeze for GNOME 2.18. Sorry. Is
> this very inconvenient for you?

Well, certainly not inconvenient enough to ask for an API break now. Besides, I should've reminded you...

(In reply to comment #3)
> - moved the Priority enum into Gnome::Vfs::Async2::Handle. Tell me if this
> doesn't make sense.

Yes, the enum is meant to be used in Async2::Handle functions only, but I thought that since all (?) enums in *mm are kept in their root namespace, this one should follow as well. It becomes a habit to expect them there. Means less typing, too.

> Is it possible that "delete handle" is being called too soon?

Well... yes. I just tried. :/

I'll add some more functionality to the example then and rearrange the code in *.ccg a bit - the lines are way too long, it's really hard to read.
Comment 5 Murray Cumming 2007-01-29 09:21:11 UTC
> the lines are way too long, it's really hard to read.

I don't think it's normal to have an editor that's only 80 monospace characters wide, so I'd prefer not to have patches confused by whitespace changes. This also makes it difficult to include the examples inline in tutorial documentation.
Comment 6 Marko Anastasov 2007-01-29 13:50:21 UTC
Created attachment 81429 [details] [review]
extended example

The example is now mostly complete.

I also have some API suggestions, but I'll open a new bug for that.
Comment 7 Marko Anastasov 2007-01-29 13:53:05 UTC
Created attachment 81430 [details] [review]
extended example, with CL entry

Sorry, forgot to add a ChangeLog entry.
Comment 8 Murray Cumming 2007-01-29 15:58:00 UTC
Applied. Well done.

So, there's no more know problem with async2?
Comment 9 Marko Anastasov 2007-01-29 21:21:29 UTC
There has been a g_warning() stating that transfer() leaks. I haven't investigated this yet. Also in the example I tried to use get_file_info(), but in my signal handler that does nothing a double delete occurred somewhere in gnome_vfs_*. I'll see what that is about.
Comment 10 Murray Cumming 2007-02-10 14:26:10 UTC
So, I am reopening this bug because it sounds like this API change is not finished. Thanks for all your effort.
Comment 11 Murray Cumming 2008-02-10 16:33:31 UTC
I'm closing this bug because giomm seems to be the answer to all our gnome-vfs problems.