[yast-commit] r39389 - in /branches/REFACTORING-10_3/pkg-bindings/src: Package.cc Source.cc
Author: lslezak Date: Fri Jul 13 10:36:06 2007 New Revision: 39389 URL: http://svn.opensuse.org/viewcvs/yast?rev=39389&view=rev Log: - fixed segfault in logFindRepository() when the repo is not found - removed extra callbacks in SourceRestore() and SourceLoad() Modified: branches/REFACTORING-10_3/pkg-bindings/src/Package.cc branches/REFACTORING-10_3/pkg-bindings/src/Source.cc Modified: branches/REFACTORING-10_3/pkg-bindings/src/Package.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/REFACTORING-10_3/pkg-bindings/src/Package.cc?rev=39389&r1=39388&r2=39389&view=diff ============================================================================== --- branches/REFACTORING-10_3/pkg-bindings/src/Package.cc (original) +++ branches/REFACTORING-10_3/pkg-bindings/src/Package.cc Fri Jul 13 10:36:06 2007 @@ -978,8 +978,7 @@ data->add( YCPString("arch"), YCPString( pkg->arch().asString() ) ); data->add( YCPString("medianr"), YCPInteger( pkg->mediaNr() ) ); - #warning FIXME: convert to Yast id (index) - std::vector<zypp::RepoInfo>::size_type sid = logFindAlias(pkg->repository().info().alias()); + std::vector<YRepo_Ptr>::size_type sid = logFindAlias(pkg->repository().info().alias()); y2debug("srcId: %d", sid ); data->add( YCPString("srcid"), YCPInteger( sid ) ); Modified: branches/REFACTORING-10_3/pkg-bindings/src/Source.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/REFACTORING-10_3/pkg-bindings/src/Source.cc?rev=39389&r1=39388&r2=39389&view=diff ============================================================================== --- branches/REFACTORING-10_3/pkg-bindings/src/Source.cc (original) +++ branches/REFACTORING-10_3/pkg-bindings/src/Source.cc Fri Jul 13 10:36:06 2007 @@ -125,9 +125,15 @@ { try { - if ((repos[id])->isDeleted()) + if (!repos[id]) { - y2error("Source %d has been deleted, the ID not valid", id); + // not found + throw(std::exception()); + } + + if (repos[id]->isDeleted()) + { + y2error("Source %d has been deleted, the ID is not valid", id); return YRepo_Ptr(); } @@ -135,7 +141,7 @@ } catch (...) { - y2error("Cannot find source %d", id); + y2error("Cannot find source with ID: %d", id); // TODO: improve the error message _last_error.setLastError(_("Cannot find source")); } @@ -186,13 +192,10 @@ YCPValue PkgModuleFunctions::SourceRestore() { - // evaluate the callbacks only when the source manager hasn't been initialized - bool enable_callbacks = repos.size() == 0; - - if (enable_callbacks) + if (repos.size() > 0) { - CallSourceReportInit(); - CallSourceReportStart(_("Downloading files...")); + y2warning("Number of registered repositories: %d, skipping repository load!", repos.size()); + return YCPBoolean(true); } bool success = true; @@ -217,12 +220,6 @@ success = false; } - if (enable_callbacks) - { - CallSourceReportEnd(_("Downloading files...")); - CallSourceReportDestroy(); - } - return YCPBoolean(success); } @@ -252,7 +249,6 @@ YCPValue PkgModuleFunctions::SourceLoad() { - bool callbacks_evaluated = false; bool success = true; for (std::vector<YRepo_Ptr>::iterator it = repos.begin(); @@ -276,13 +272,6 @@ try { - if (!callbacks_evaluated) - { - CallSourceReportInit(); - CallSourceReportStart(_("Parsing files...")); - callbacks_evaluated = true; - } - // build cache if needed if (!repomanager.isCached((*it)->repoInfo())) { @@ -319,12 +308,6 @@ } } - if (callbacks_evaluated) - { - CallSourceReportEnd(_("Parsing files...")); - CallSourceReportDestroy(); - } - return YCPBoolean(success); } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
lslezak@svn.opensuse.org