diff --git a/jni/NativeFormats/fbreader/src/formats/css/StyleSheetParser.cpp b/jni/NativeFormats/fbreader/src/formats/css/StyleSheetParser.cpp index feaf24263..4ce4925bf 100644 --- a/jni/NativeFormats/fbreader/src/formats/css/StyleSheetParser.cpp +++ b/jni/NativeFormats/fbreader/src/formats/css/StyleSheetParser.cpp @@ -270,8 +270,7 @@ void StyleSheetMultiStyleParser::storeData(const std::string &selector, const St ZLLogger::Instance().println("CSS-SELECTOR", "SELE = '" + selector->Tag + "." + selector->Class + "'"); store(selector, map); while (!selector->Next.isNull()) { - shared_ptr s = selector->Next->Selector; - selector = s; + selector = selector->Next->Selector; ZLLogger::Instance().println("CSS-SELECTOR", "SUB SELE = '" + selector->Tag + "." + selector->Class + "'"); } } diff --git a/jni/NativeFormats/zlibrary/core/src/util/shared_ptr.h b/jni/NativeFormats/zlibrary/core/src/util/shared_ptr.h index b74e4a38f..fd811e4bc 100644 --- a/jni/NativeFormats/zlibrary/core/src/util/shared_ptr.h +++ b/jni/NativeFormats/zlibrary/core/src/util/shared_ptr.h @@ -216,17 +216,22 @@ inline const shared_ptr &shared_ptr::operator = (T *t) { template inline const shared_ptr &shared_ptr::operator = (const shared_ptr &t) { if (&t != this) { + t.myStorage->addReference(); detachStorage(); attachStorage(t.myStorage); + t.myStorage->removeReference(); } return *this; } template inline const shared_ptr &shared_ptr::operator = (const weak_ptr &t) { - detachStorage(); if (!t.isNull()) { + t.myStorage->addReference(); + detachStorage(); attachStorage(t.myStorage); + t.myStorage->removeReference(); } else { + detachStorage(); attachStorage(0); } return *this;