Work around glibc/libstdc/gcc/g++ nested new() object bug

Closes Bug #456


git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1227273 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 13 years ago
parent 47a3b88d5b
commit 39dc2df1ab

@ -59,8 +59,19 @@ extern KDesktopApp *myApp;
/**** KBackgroundManager ****/ /**** KBackgroundManager ****/
KBackgroundManager::KBackgroundManager()
: DCOPObject("KBackgroundIface")
{
// Everything will be initialized later
}
KBackgroundManager::KBackgroundManager(TQWidget *desktop, KWinModule* kwinModule) KBackgroundManager::KBackgroundManager(TQWidget *desktop, KWinModule* kwinModule)
: DCOPObject("KBackgroundIface") : DCOPObject("KBackgroundIface")
{
initializeManager(desktop, kwinModule);
}
void KBackgroundManager::initializeManager(TQWidget *desktop, KWinModule* kwinModule)
{ {
if( !properties_inited ) if( !properties_inited )
{ {

@ -61,9 +61,11 @@ class KBackgroundManager
TQ_OBJECT TQ_OBJECT
public: public:
KBackgroundManager();
KBackgroundManager(TQWidget *desktop, KWinModule* kwinModule); KBackgroundManager(TQWidget *desktop, KWinModule* kwinModule);
~KBackgroundManager(); ~KBackgroundManager();
void initializeManager(TQWidget *desktop, KWinModule* kwinModule);
void configure(); void configure();
void setCommon(int); void setCommon(int);
bool isCommon() { return m_bCommon; }; bool isCommon() { return m_bCommon; };

@ -20,7 +20,6 @@
#include "desktop.h" #include "desktop.h"
#include "krootwm.h" #include "krootwm.h"
#include "bgmanager.h"
#include "bgsettings.h" #include "bgsettings.h"
#include "startupid.h" #include "startupid.h"
#include "kdiconview.h" #include "kdiconview.h"
@ -197,7 +196,6 @@ KDesktop::KDesktop( bool x_root_hack, bool wait_for_kded ) :
m_pIconView = 0; m_pIconView = 0;
m_pRootWidget = 0; m_pRootWidget = 0;
bgMgr = 0;
initRoot(); initRoot();
TQTimer::singleShot(0, this, TQT_SLOT( slotStart() )); TQTimer::singleShot(0, this, TQT_SLOT( slotStart() ));
@ -218,8 +216,6 @@ KDesktop::initRoot()
if ( !m_bDesktopEnabled && !m_pRootWidget ) if ( !m_bDesktopEnabled && !m_pRootWidget )
{ {
hide(); hide();
delete bgMgr;
bgMgr = 0;
if ( m_pIconView ) if ( m_pIconView )
m_pIconView->saveIconPositions(); m_pIconView->saveIconPositions();
delete m_pIconView; delete m_pIconView;
@ -243,9 +239,9 @@ KDesktop::initRoot()
// Geert Jansen: backgroundmanager belongs here // Geert Jansen: backgroundmanager belongs here
// TODO tell KBackgroundManager if we change widget() // TODO tell KBackgroundManager if we change widget()
bgMgr = new KBackgroundManager( m_pIconView, m_pKwinmodule ); bgMgr.initializeManager( m_pIconView, m_pKwinmodule );
bgMgr->setExport(1); bgMgr.setExport(1);
connect( bgMgr, TQT_SIGNAL( initDone()), TQT_SLOT( backgroundInitDone())); connect( &bgMgr, TQT_SIGNAL( initDone()), TQT_SLOT( backgroundInitDone()));
if (!m_bInit) if (!m_bInit)
{ {
delete KRootWm::self(); delete KRootWm::self();
@ -256,8 +252,6 @@ KDesktop::initRoot()
} }
else if (m_bDesktopEnabled && !m_pIconView) else if (m_bDesktopEnabled && !m_pIconView)
{ {
delete bgMgr;
bgMgr = 0;
delete m_pRootWidget; delete m_pRootWidget;
m_pRootWidget = 0; m_pRootWidget = 0;
m_pIconView = new KDIconView( this, 0 ); m_pIconView = new KDIconView( this, 0 );
@ -284,9 +278,9 @@ KDesktop::initRoot()
// Geert Jansen: backgroundmanager belongs here // Geert Jansen: backgroundmanager belongs here
// TODO tell KBackgroundManager if we change widget() // TODO tell KBackgroundManager if we change widget()
bgMgr = new KBackgroundManager( m_pIconView, m_pKwinmodule ); bgMgr.initializeManager( m_pIconView, m_pKwinmodule );
bgMgr->setExport(1); bgMgr.setExport(1);
connect( bgMgr, TQT_SIGNAL( initDone()), TQT_SLOT( backgroundInitDone())); connect( &bgMgr, TQT_SIGNAL( initDone()), TQT_SLOT( backgroundInitDone()));
// make sure it is initialized before we first call updateWorkArea() // make sure it is initialized before we first call updateWorkArea()
m_pIconView->initConfig( m_bInit ); m_pIconView->initConfig( m_bInit );
@ -436,8 +430,6 @@ KDesktop::~KDesktop()
{ {
delete m_miniCli; delete m_miniCli;
m_miniCli = 0; // see #120382 m_miniCli = 0; // see #120382
delete bgMgr;
bgMgr = 0;
delete startup_id; delete startup_id;
} }
@ -937,11 +929,11 @@ void KDesktop::handleColorDropEvent(TQDropEvent * e)
TQColor c; TQColor c;
KColorDrag::decode(e, c); KColorDrag::decode(e, c);
switch (result) { switch (result) {
case 1: bgMgr->setColor(c, true); break; case 1: bgMgr.setColor(c, true); break;
case 2: bgMgr->setColor(c, false); break; case 2: bgMgr.setColor(c, false); break;
default: return; default: return;
} }
bgMgr->setWallpaper(0,0); bgMgr.setWallpaper(0,0);
} }
void KDesktop::handleImageDropEvent(TQDropEvent * e) void KDesktop::handleImageDropEvent(TQDropEvent * e)
@ -993,7 +985,7 @@ void KDesktop::handleImageDropEvent(TQDropEvent * e)
KTempFile tmpFile(KGlobal::dirs()->saveLocation("wallpaper"), ".png"); KTempFile tmpFile(KGlobal::dirs()->saveLocation("wallpaper"), ".png");
i.save(tmpFile.name(), "PNG"); i.save(tmpFile.name(), "PNG");
kdDebug(1204) << "KDesktop::contentsDropEvent " << tmpFile.name() << endl; kdDebug(1204) << "KDesktop::contentsDropEvent " << tmpFile.name() << endl;
bgMgr->setWallpaper(tmpFile.name()); bgMgr.setWallpaper(tmpFile.name());
} }
} }
@ -1002,7 +994,7 @@ void KDesktop::slotNewWallpaper(const KURL &url)
// This is called when a file containing an image is dropped // This is called when a file containing an image is dropped
// (called by KonqOperations) // (called by KonqOperations)
if ( url.isLocalFile() ) if ( url.isLocalFile() )
bgMgr->setWallpaper( url.path() ); bgMgr.setWallpaper( url.path() );
else else
{ {
// Figure out extension // Figure out extension
@ -1014,7 +1006,7 @@ void KDesktop::slotNewWallpaper(const KURL &url)
KURL localURL; localURL.setPath( tmpFile.name() ); KURL localURL; localURL.setPath( tmpFile.name() );
// We pass 0 as parent window because passing the desktop is not a good idea // We pass 0 as parent window because passing the desktop is not a good idea
KIO::NetAccess::file_copy( url, localURL, -1, true /*overwrite*/ ); KIO::NetAccess::file_copy( url, localURL, -1, true /*overwrite*/ );
bgMgr->setWallpaper( localURL.path() ); bgMgr.setWallpaper( localURL.path() );
} }
} }

@ -21,6 +21,7 @@
#define __desktop_h__ #define __desktop_h__
#include "KDesktopIface.h" #include "KDesktopIface.h"
#include "bgmanager.h"
#include <tqwidget.h> #include <tqwidget.h>
#include <tqstringlist.h> #include <tqstringlist.h>
@ -190,7 +191,7 @@ private:
KWinModule* m_pKwinmodule; KWinModule* m_pKwinmodule;
KBackgroundManager* bgMgr; KBackgroundManager bgMgr;
KDIconView *m_pIconView; KDIconView *m_pIconView;
KRootWidget *m_pRootWidget; KRootWidget *m_pRootWidget;

@ -69,7 +69,7 @@ KRootWm * KRootWm::s_rootWm = 0;
extern TQCString kdesktop_name, kicker_name, kwin_name; extern TQCString kdesktop_name, kicker_name, kwin_name;
KRootWm::KRootWm(KDesktop* _desktop) : TQObject(_desktop) KRootWm::KRootWm(KDesktop* _desktop) : TQObject(_desktop), startup(FALSE)
{ {
s_rootWm = this; s_rootWm = this;
m_actionCollection = new KActionCollection(_desktop, this, "KRootWm::m_actionCollection"); m_actionCollection = new KActionCollection(_desktop, this, "KRootWm::m_actionCollection");

Loading…
Cancel
Save