[ wxwindows-Bugs-1767929 ] Access violation on using
wxHtmlParser::PopTagHandler()
SourceForge.net
noreply at sourceforge.net
Thu Oct 11 19:20:16 PDT 2007
Bugs item #1767929, was opened at 2007-08-05 07:31
Message generated for change (Comment added) made by sf-robot
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1767929&group_id=9863
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Common
Group: Fatal
>Status: Closed
Resolution: Fixed
Priority: 5
Private: No
Submitted By: Harald Meyer auf\'m Hofe (harald_meyer)
Assigned to: Vaclav Slavik (vaclavslavik)
Summary: Access violation on using wxHtmlParser::PopTagHandler()
Initial Comment:
The documentation advises to use
wxHtmlParser::PushTagHandler()/
wxHtmlTagHandler::ParseInner()/
wxHtmlParser::PopTagHandler()
in order to introduce HTML tags nested into another tag. However, such procedure leads to access violation execeptions at least on VC 8 (but probably also with other compilers). Reason: Implementation error in class wxList (without using STL) in wx/list.h:1149 (Version 2.6.4 but this is also relevant to 2.8.3).
PushTagHandler copies a Hashtable into a list element. PopTagHandler pops this list element to restore the hash table. The hash table uses wxList::operator=() to copy the elements of a bucket. However, wxList::operator=() relies on an implementation of wxListBase::operator=() that does not exist (wx/list.h:1149). Thus, the C++ default implementation will copy all members of the list base into the new one. Unfortunately, these nodes will later be destroyed in PopTagHandler. So, we have buckets with partially destroyed list nodes causing exceptions on access violation.
This problem can be solved using wxListBase::Assign() instead of wxListBase::operator=() in wxList::operator=() (as in the code generated by the macros implementing lists bound to a particuar data type).
This solution is apparently consistent with other lists in wxWidgets although the standard procedure of assigning lists (in other programming languages) usually refrains from copying list nodes due to complexity issues. So, the proposed solution of changing the assignment operator in wxList might not be the desired behaviour. Nevertheless, the usage of lists as buckets in hash table is inconsistent.
----------------------------------------------------------------------
>Comment By: SourceForge Robot (sf-robot)
Date: 2007-10-11 19:20
Message:
Logged In: YES
user_id=1312539
Originator: NO
This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).
----------------------------------------------------------------------
Comment By: Vaclav Slavik (vaclavslavik)
Date: 2007-09-27 08:21
Message:
Logged In: YES
user_id=80834
Originator: NO
I fixed wxList::operator=() on the trunk to be consistent with typed
lists. I couldn't do the same on 2.8 branch because of binary compatibility
(the code is inline), but I modified wxHashTable::DoCopy() to use Assign().
Can you please check if it works now?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1767929&group_id=9863
More information about the wx-dev
mailing list