mark at kingant.net
Tue Jun 26 02:40:56 EDT 2007
To preface my response, I'm not very familiar with libpurple's notify
searchresults API. I also don't understand your problem 100%.
On Tue, 26 Jun 2007 02:46:52 +0200, Andreas Monitzer wrote
> notify_searchresults returns a pointer to my controller object,
> which owns the search result window.
Hmm, I think this is the wrong way to look at it. I think libpurple's
PurpleNotifyInfo owns your controller object.
> When additional results
> arrive, I can simply reference my object via the data parameter of
> notify_searchresults_new_rows. So far, that should work fine.
> However, when the user closes the search results window, and
> afterwards notify_searchresults_new_rows gets called, I'd get a
> dangling pointer and the app would crash. There's no way to tell
> the API that I don't want to receive any further information.
When the user clicks the red bubble to close the search results window, you
should call either purple_notify_close() or purple_notify_close_with_handle()
to destroy the libpurple side of the search results window. That will call
the close_notify ui_op in Adium (your code), which should in turn close the
search results window. Does that make sense?
> Additionally, I can't disallow closing the window until the search
> is complete, since there is no callback for that event (this also
> inhibits me keeping the controller object around until no more
> search results can pour in).
I can't speak on behalf of the Adium people, but this sounds like a bad idea
to me. If a user wants to close a window you should let them. If you get
additional search results after that then they should be discarded. But don't
worry! It shouldn't be necessary.
> I can't disallow further calls to
> notify_searchresults_new_rows (so that notify_searchresults would be
> called again), since I can't set my ui pointer to NULL in
> libpurple's data space. if it'd return NULL in the first place,
> this would be interpreted as an error result, and a error message
> would be displayed.
Hopefully calling purple_notify_close() or purple_notify_close_with_handle()
as mentioned above will make this a moot point. I have no idea how you're
using the search results API... but you might need to keep track of whether
the window has been closed, and if it HAS been closed then just discard any
search results that you get.
More information about the Devel