Mailinglist Archive: opensuse-bugs (4760 mails)

< Previous Next >
[Bug 597772] “Find” function in gpk-application is limited to accurate match
  • From: bugzilla_noreply@xxxxxxxxxx
  • Date: Thu, 22 Apr 2010 09:15:13 +0000
  • Message-id: <20100422091514.0E131CC69A@xxxxxxxxxxxxxxxxxxxxxx>

--- Comment #6 from Peter Zhu <peter.j.zhu@xxxxxxxxx> 2010-04-22 09:15:13 UTC
(In reply to comment #3)
Having a glimpse at the backend code, I see some switch in
pk-backend-zypp.cpp(backend_find_packages_thread) that calls
zypp_get_packages_by_name, _by_details or _by_file (in zypp-utils.cpp) to
perform the search.

zypp_get_packages_by_name uses exact matching, probably because it's used from
other locations too.

I also see a memory leak in backend_find_packages_thread. Don't know whether
it's actually necessary to use dynamically allocated 'std::vector', but the
pointer should not be initialized with 'new std::vector' if later the query
result is simply assigned. I don't know why this is not implemented using a
plain std::vector. Other methods like zypp_get_patches also return pointer to
allocated memory, but not all calling locations save the pointer and take care
about calling delete. If all those really need to be created dynamically, it
cries for a RAII solution.

@Scott: I attach 2 (untested) patches. One for the memory leak and my
suggestion how to fix backend_find_packages using a PoolQuery. The comments
suggested that you'd like to support multiple search strings (OR'ed).
would be able to do this.

Thanks Michael. The two patches work very well and fix the find issue

Configure bugmail:
------- You are receiving this mail because: -------
You are on the CC list for the bug.

< Previous Next >