Opened 2 years ago

Closed 2 years ago

#14638 closed defect (fixed)

wxLocalFSHandler::OpenFile() is constructing wxFSFile with incomplete location

Reported by: wsu Owned by:
Priority: normal Milestone: 2.9.5
Component: base Version: stable-latest
Keywords: wxLocalFSHandler wxFSFile GetLocation Cc: vaclavslavik
Blocked By: Blocking:
Patch: yes

Description

The wxFSFile::GetLocation() docs say the returned string includes the protocol. Also, if you look at handlers, e.g. wxMemoryFSHandlerBase and wxArchiveFSHandler, they provide the full location information when creating wxFSFile. However, wxLocalFSHandler::OpenFile() does not create the wxFSFile with protocol information.

This can be seen when running the html/help sample in wxMSW. If you use File | Help to open the help viewer, and then push the Next (wxID_HTML_DOWN) button, nothing happens. However, if you apply the attached patch, the Next button will work (as will the Previous button). The problem is that the wxHtmlBookRecord objects are being passed the wxFSFile::GetLocation() values, but those values are only partial matches for the keys used by wxHtmlHelpWindow::m_PagesHash.

Attachments (1)

wxFSFile location.patch download (419 bytes) - added by wsu 2 years ago.

Download all attachments as: .zip

Change History (5)

Changed 2 years ago by wsu

comment:1 Changed 2 years ago by vadz

  • Cc vaclavslavik added
  • Milestone set to 2.9.5
  • Status changed from new to confirmed

This looks correct to me but OTOH I'm almost sure that the current code was written like this intentionally so I wonder if this could break something else.

Vaclav, would you remember by chance why was it written like this or even just whether this was indeed intentional or not?

comment:2 Changed 2 years ago by vaclavslavik

I don't think it was intentional (the example URLs in the docs are something I wouldn't use later than in 2000-or-so when this was originally written... jeez, I'm old). Looks like a right thing to do to me, but there's no telling when side-effect it may have on this convoluted mess.

comment:3 Changed 2 years ago by vadz

Thanks for the confirmation. As for breakage, there is only one way to find out: let's apply this and see if anybody complains...

comment:4 Changed 2 years ago by VZ

  • Resolution set to fixed
  • Status changed from confirmed to closed

(In [72649]) Do return the protocol part from GetLocaltion() for local wxFSFiles.

wxLocalFSHandler created wxFSFile without the protocol information which means
that calling GetLocaltion() on this file later doesn't return it, contrary to
the documentation.

Do include the protocol to fix this.

Closes #14638.

Note: See TracTickets for help on using tickets.