View | Details | Raw Unified | Return to issue 102220
Collapse All | Expand All

(-)dtrans.orig/source/X11/X11_selection.cxx (-13 / +9 lines)
Lines 203-212 Link Here
203
203
204
// ------------------------------------------------------------------------
204
// ------------------------------------------------------------------------
205
205
206
SelectionManager::InstanceHolder::~InstanceHolder()
207
{
208
    ::std::hash_map< OUString, SelectionManager*, OUStringHash >::iterator it;
209
    for( it = maInstances.begin(); it != maInstances.end(); ++it )
210
        delete it->second;
211
}
212
206
::std::hash_map< OUString, SelectionManager*, OUStringHash >& SelectionManager::getInstances()
213
::std::hash_map< OUString, SelectionManager*, OUStringHash >& SelectionManager::getInstances()
207
{
214
{
208
    static ::std::hash_map< OUString, SelectionManager*, OUStringHash > aInstances;
215
    static InstanceHolder aInstanceHolder;
209
    return aInstances;
216
    return aInstanceHolder.maInstances;
210
}
217
}
211
218
212
// ------------------------------------------------------------------------
219
// ------------------------------------------------------------------------
Lines 470-487 Link Here
470
#if OSL_DEBUG_LEVEL > 1
477
#if OSL_DEBUG_LEVEL > 1
471
	fprintf( stderr, "SelectionManager::~SelectionManager (%s)\n", m_pDisplay ? DisplayString(m_pDisplay) : "no display" );
478
	fprintf( stderr, "SelectionManager::~SelectionManager (%s)\n", m_pDisplay ? DisplayString(m_pDisplay) : "no display" );
472
#endif
479
#endif
473
	{
474
		MutexGuard aGuard( *Mutex::getGlobalMutex() );
475
480
476
		::std::hash_map< OUString, SelectionManager*, OUStringHash >::iterator it;
477
		for( it = getInstances().begin(); it != getInstances().end(); ++it )
478
			if( it->second == this )
479
			{
480
				getInstances().erase( it );
481
				break;
482
			}
483
	}
484
    
485
	if( m_aThread )
481
	if( m_aThread )
486
	{
482
	{
487
		osl_terminateThread( m_aThread );
483
		osl_terminateThread( m_aThread );
(-)dtrans.orig/source/X11/X11_selection.hxx (+7 lines)
Lines 252-257 Link Here
252
				{ m_pTarget = rEntry.m_pTarget; m_aRootWindow = rEntry.m_aRootWindow; return *this; }
252
				{ m_pTarget = rEntry.m_pTarget; m_aRootWindow = rEntry.m_aRootWindow; return *this; }
253
		};
253
		};
254
254
255
		// a struct to hold data associated with each instance to clean-up
256
		struct InstanceHolder
257
		{
258
			::std::hash_map< ::rtl::OUString, SelectionManager*, ::rtl::OUStringHash > maInstances;
259
			~InstanceHolder();
260
		};
261
255
		// internal data
262
		// internal data
256
		Display*					m_pDisplay;
263
		Display*					m_pDisplay;
257
		oslThread					m_aThread;
264
		oslThread					m_aThread;

Return to issue 102220