Added Delete member to wxStringHashTable in order to implement

wxHelpProvider::RemoveHelp, which is now called from ~wxWindowBase.
Without cleaning up the hash tables, reused window addresses will cause
the CS help to fail rather comically over time.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15754 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2002-06-05 21:06:18 +00:00
parent 4bb081fd23
commit 53e112a093
8 changed files with 102 additions and 24 deletions

View File

@@ -1,4 +1,3 @@
<HTML> <HTML>
<HEAD> <HEAD>
@@ -31,6 +30,7 @@ See also <a href="faq.htm">top-level FAQ page</a>.
<li><a href="#specific">How does wxWindows 2 support platform-specific features?</a></li> <li><a href="#specific">How does wxWindows 2 support platform-specific features?</a></li>
<li><a href="#stl">Does wxWindows use STL? or the standard string class?</a></li> <li><a href="#stl">Does wxWindows use STL? or the standard string class?</a></li>
<li><a href="#richedit">Is there a rich edit/markup widget for wxWindows 2?</a></ li> <li><a href="#richedit">Is there a rich edit/markup widget for wxWindows 2?</a></ li>
<li><a href="#exceptions">How to use C++ exceptions with wxWindows?</a></ li>
<li><a href="#dev">How is wxWindows 2 being developed?</a></li> <li><a href="#dev">How is wxWindows 2 being developed?</a></li>
<li><a href="#distrib">How is wxWindows 2 distributed?</a></li> <li><a href="#distrib">How is wxWindows 2 distributed?</a></li>
<li><a href="#future">What are the plans for the future?</a></li> <li><a href="#future">What are the plans for the future?</a></li>
@@ -172,6 +172,34 @@ no wxWindows wrapper for these (but text attribute functions are being added in
<P> <P>
<h3><a name="exceptions">How to use C++ exceptions with wxWindows?</a></h3>
wxWindows library itself is unfortunately <i>not</i> exception-safe (as its
initial version predates, by far, the addition of the exceptions to the C++
language). However you can still use the exceptions in your own code and use
the other libraries using the exceptions for the error reporting together with
wxWindows.
<p>
There are a few issues to keep in mind, though:
<ul>
<li>You shouldn&#39;t let the exceptions propagate through wxWindows code,
in particular you should always catch the exceptions thrown by the
functions called from an event handler in the handler itself and not
let them propagate upwards to wxWindows.
<li>You may need to ensure that the compiler support for the exceptions is
enabled as, considering that wxWindows itself doesn&#39;t use the
exceptions and turning their support on results in the library size
augmentation of 10% to 20%, it is turned off by default for a few
compilers. Moreover, for gcc (or at least its mingw version) you must
also turn on the RTTI support to be able to use the exceptions, so you
should use <tt>--disable-no_rtti --disable-no_exceptions</tt> options
when configuring the library (attention to the double negation).
</ul>
<p>
<H3><a name="dev">How is wxWindows 2 being developed?</a></H3> <H3><a name="dev">How is wxWindows 2 being developed?</a></H3>
We are using the <a href="cvs.htm">CVS</a> system to develop and maintain wxWindows. This allows We are using the <a href="cvs.htm">CVS</a> system to develop and maintain wxWindows. This allows

View File

@@ -28,6 +28,8 @@ See also <a href="faq.htm">top-level FAQ page</a>.
<li><a href="#gnome">Does wxGTK have GNOME support?</a></li> <li><a href="#gnome">Does wxGTK have GNOME support?</a></li>
<li><a href="#redhat">Warning about GTK libraries supplied with RedHat</a></li> <li><a href="#redhat">Warning about GTK libraries supplied with RedHat</a></li>
<li><a href="#wxgtk">What is wxWindows 2 for GTK?</a></li> <li><a href="#wxgtk">What is wxWindows 2 for GTK?</a></li>
<li><a href="#bincompat">What range of Intel Linux platforms will a given application binary be usable on?</li>
<hr> <hr>
wxWindows 2 for GTK is a port of wxWindows to the <a href="http://www.gimp.org/gtk" target=_top>GTK+ toolkit</a>, wxWindows 2 for GTK is a port of wxWindows to the <a href="http://www.gimp.org/gtk" target=_top>GTK+ toolkit</a>,
@@ -53,6 +55,17 @@ the client will get notified twice, first getting a LOST event and then a CONNEC
This problem can be solved by updating GTK with an official distribution of the library. This problem can be solved by updating GTK with an official distribution of the library.
<P> <P>
<h3><a name="bincompat">What range of Intel Linux platforms will a given application binary be usable on?</h3>
Robert Roebling replies:<P>
"The important thing is the libc version that your app
is linked against. The most recent version is 2.2.5
and programs linked against it will not run with version
2.1.X so that you will fare best if you compile your app
on a 2.1.X system. It will then run on practically all
Linux distros (if you link you app statically against
the image libraries and std C++ lib)."
</font> </font>

View File

@@ -25,10 +25,10 @@ See also <a href="faq.htm">top-level FAQ page</a>.
<hr> <hr>
<h3>List of questions in this category</h3> <h3>List of questions in this category</h3>
<ul> <ul>
<li><a href="#release">When is wxMac 2.x due to be released?</a></li> <li><a href="#release">Where should I download wxMac from?</a></li>
<li><a href="#macplat">Which Mac platforms are supported?</a></li> <li><a href="#macplat">Which Mac platforms are supported?</a></li>
<li><a href="#macosx">How is the Mac OS X port different from the Classic Mac OS port?</a></li> <li><a href="#macosx">How is the Mac OS X port different from the Classic Mac OS port?</a></li>
<li><a href="#macclassic">How are improvements to the Classic Mac OS port integra ted into the Mac OS X port?</a></li> <li><a href="#macclassic">How are improvements to the Classic Mac OS port integrated into the Mac OS X port?</a></li>
<li><a href="#compilers">What compilers are supported?</a></li> <li><a href="#compilers">What compilers are supported?</a></li>
<li><a href="#filetypes">How does CVS handle file types/creators under Mac OS 8.x /9.x?</a></li> <li><a href="#filetypes">How does CVS handle file types/creators under Mac OS 8.x /9.x?</a></li>
<li><a href="#filetypesx">How does CVS handle file types/creators under Mac OS X? </a></li> <li><a href="#filetypesx">How does CVS handle file types/creators under Mac OS X? </a></li>
@@ -39,24 +39,15 @@ See also <a href="faq.htm">top-level FAQ page</a>.
<li><a href="#aboutmenu">How does wxMac support the standard Apple About menu item and Help menu?</a></li> <li><a href="#aboutmenu">How does wxMac support the standard Apple About menu item and Help menu?</a></li>
</ul> </ul>
<hr> <hr>
<h3><a name="release">When is wxMac 2.x due to be released?</a></h3>
There is a <a href="dl_mac2.htm">preview</a> available. <h3><a name="release">Where should I download wxMac from?</a></h3>
The author of this port is <a href="mailto:csomor@advancedconcepts.ch">Stefan Csomor</a>.
Please see the <a href="dl_mac2.htm">downloads page</a>.
The version of wxMac in CVS advances quickly so it is recommended that you download the
the sources from the <a href="cvs.htm">CVS trunk</a>.
There is also a wxMac 2.3.1 <a href="dl_mac2.htm#dev">development snapshot</a>.
<P> <P>
The author of this port is <a href="mailto:csomor@advancedconcepts.ch">Stefan Csomor</a>.
<table border=0 cellpadding=5>
<tr>
<td bgcolor="#004080">
<font face="Arial, Lucida Sans, Helvetica">
<font size=2>
Please note that the version of wxMac in CVS is more robust and nearly feature-complete compared with the packaged 2.0 release.
Until a new release is made, it is recommended that you download the wxMac 2.3.1 <a href="dl_mac2.htm#dev">development snapshot</a> or the sources from the <a href="cvs.htm">CVS trunk</a>.
</font>
</font></td>
</tr>
</table>
<P> <P>
<h3><a name="macplat">Which Mac platforms are supported?</a></h3> <h3><a name="macplat">Which Mac platforms are supported?</a></h3>

View File

@@ -1,4 +1,3 @@
<html> <html>
<head> <head>
<title>Platforms supported by wxWindows 2.x</title> <title>Platforms supported by wxWindows 2.x</title>
@@ -118,10 +117,15 @@ often don&#39;t work.
</tr> </tr>
<tr> <tr>
<td bgcolor="#F0F0F0" align=center valign=center rowspan=3>IRIX</td> <td bgcolor="#F0F0F0" align=center valign=center rowspan=6>IRIX</td>
<td>wxGTK</td><td align=center><IMG SRC="images/yes.gif" ALT=Ok></td><td><br></td><td>You may need to use <tt>--disable-catch_segvs</tt> if you get compiler error in utilsunx.cpp</td> <tr> <td bgcolor="#fafafa" colspan=5>
<tr> <td>wxMotif with MIPSPro 7.30</td><td align=center><IMG SRC="images/yes.gif" ALT=Ok></td><td>David Marshall</td><td>On IRIX 6.5.6 (Indigo2, 64bit), with SGI Motif 1.2</td> Note that all entries use MIPSPro 7.3 compiler on IRIX 6.5.9 with <tt>-mips3 -n32</tt> flags if not mentioned otherwise.
<tr> <td>wxMotif with "CC -mips3 -n32"</td><td align=center><IMG SRC="images/yes.gif" ALT=Ok></td><td>Ian</td><td>You need to set LD_LIBRARYN32_PATH</td> Also note that you need to set <tt>LD_LIBRARYN32_PATH</tt> under IRIX to run wxWindows programs.
</td>
<tr> <td>wxGTK 2.2</td><td align=center><IMG SRC="images/yes.gif" ALT=Ok></td><td>Ian</td><td>You may need to use <tt>--disable-catch_segvs</tt> if you get compiler error in utilsunx.cpp</td>
<tr> <td>wxGTK 2.3</td><td align=center><IMG SRC="images/yes.gif" ALT=Ok></td><td>Carl Godkin</td><td><br></td>
<tr> <td rowspan=2>wxMotif</td><td align=center><IMG SRC="images/yes.gif" ALT=Ok></td><td>David Marshall</td><td>On IRIX 6.5.6 (Indigo2, 64bit), with SGI Motif 1.2</td>
<tr> <td align=center><IMG SRC="images/yes.gif" ALT=Ok></td><td>Ian</td><td><br></td>
</tr> </tr>
<tr> <tr>

View File

@@ -124,6 +124,9 @@ public:
// the application, for example) // the application, for example)
virtual void AddHelp(wxWindowID id, const wxString& text); virtual void AddHelp(wxWindowID id, const wxString& text);
// removes the association
virtual void RemoveHelp(wxWindowBase* window);
// virtual dtor for any base class // virtual dtor for any base class
virtual ~wxHelpProvider(); virtual ~wxHelpProvider();
@@ -142,6 +145,7 @@ public:
virtual bool ShowHelp(wxWindowBase *window); virtual bool ShowHelp(wxWindowBase *window);
virtual void AddHelp(wxWindowBase *window, const wxString& text); virtual void AddHelp(wxWindowBase *window, const wxString& text);
virtual void AddHelp(wxWindowID id, const wxString& text); virtual void AddHelp(wxWindowID id, const wxString& text);
virtual void RemoveHelp(wxWindowBase* window);
protected: protected:
// we use 2 hashes for storing the help strings associated with windows // we use 2 hashes for storing the help strings associated with windows

View File

@@ -127,6 +127,9 @@ public:
// and the wasFound is set to FALSE if not NULL // and the wasFound is set to FALSE if not NULL
wxString Get(long key, bool *wasFound = NULL) const; wxString Get(long key, bool *wasFound = NULL) const;
// remove the item, returning TRUE if the item was found and deleted
bool Delete(long key) const;
// clean up // clean up
void Destroy(); void Destroy();

View File

@@ -301,6 +301,11 @@ void wxHelpProvider::AddHelp(wxWindowID WXUNUSED(id),
{ {
} }
// removes the association
void wxHelpProvider::RemoveHelp(wxWindowBase* WXUNUSED(window))
{
}
wxHelpProvider::~wxHelpProvider() wxHelpProvider::~wxHelpProvider()
{ {
} }
@@ -329,6 +334,12 @@ void wxSimpleHelpProvider::AddHelp(wxWindowID id, const wxString& text)
m_hashIds.Put(id, text); m_hashIds.Put(id, text);
} }
// removes the association
void wxSimpleHelpProvider::RemoveHelp(wxWindowBase* window)
{
m_hashWindows.Delete((long)window);
}
bool wxSimpleHelpProvider::ShowHelp(wxWindowBase *window) bool wxSimpleHelpProvider::ShowHelp(wxWindowBase *window)
{ {
#if wxUSE_TIPWINDOW #if wxUSE_TIPWINDOW

View File

@@ -310,6 +310,30 @@ wxString wxStringHashTable::Get(long key, bool *wasFound) const
return _T(""); return _T("");
} }
bool wxStringHashTable::Delete(long key) const
{
wxCHECK_MSG( m_hashSize, FALSE, _T("must call Create() first") );
size_t slot = (size_t)abs((int)(key % (long)m_hashSize));
wxArrayLong *keys = m_keys[slot];
if ( keys )
{
size_t count = keys->GetCount();
for ( size_t n = 0; n < count; n++ )
{
if ( keys->Item(n) == key )
{
keys.RemoveAt(n);
m_values[slot]->RemoveAt(n);
return TRUE;
}
}
}
return FALSE;
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// old not type safe wxHashTable // old not type safe wxHashTable
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------