continue with other handlers if some handler fails in LoadFile() after returning true from CanRead() (modified patch 1926226)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53048 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2159,13 +2159,19 @@ int wxImage::GetImageCount( wxInputStream &stream, long type )
|
|||||||
|
|
||||||
if ( type == wxBITMAP_TYPE_ANY )
|
if ( type == wxBITMAP_TYPE_ANY )
|
||||||
{
|
{
|
||||||
wxList &list=GetHandlers();
|
const wxList& list = GetHandlers();
|
||||||
|
|
||||||
for (wxList::compatibility_iterator node = list.GetFirst(); node; node = node->GetNext())
|
for ( wxList::compatibility_iterator node = list.GetFirst();
|
||||||
|
node;
|
||||||
|
node = node->GetNext() )
|
||||||
{
|
{
|
||||||
handler=(wxImageHandler*)node->GetData();
|
handler = (wxImageHandler*)node->GetData();
|
||||||
if ( handler->CanRead(stream) )
|
if ( handler->CanRead(stream) )
|
||||||
return handler->GetImageCount(stream);
|
{
|
||||||
|
const int count = handler->GetImageCount(stream);
|
||||||
|
if ( count >= 0 )
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2202,17 +2208,22 @@ bool wxImage::LoadFile( wxInputStream& stream, long type, int index )
|
|||||||
|
|
||||||
if ( type == wxBITMAP_TYPE_ANY )
|
if ( type == wxBITMAP_TYPE_ANY )
|
||||||
{
|
{
|
||||||
wxList &list=GetHandlers();
|
const wxList& list = GetHandlers();
|
||||||
|
for ( wxList::compatibility_iterator node = list.GetFirst();
|
||||||
for ( wxList::compatibility_iterator node = list.GetFirst(); node; node = node->GetNext() )
|
node;
|
||||||
|
node = node->GetNext() )
|
||||||
{
|
{
|
||||||
handler=(wxImageHandler*)node->GetData();
|
handler = (wxImageHandler*)node->GetData();
|
||||||
if ( handler->CanRead(stream) )
|
if ( handler->CanRead(stream) &&
|
||||||
return handler->LoadFile(this, stream, true/*verbose*/, index);
|
handler->LoadFile(this, stream, true/*verbose*/, index) )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLogWarning( _("No handler found for image type.") );
|
wxLogWarning( _("No handler found for image type.") );
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user