[Scummvm-cvs-logs] SF.net SVN: scummvm: [27925] scummex/branches/gsoc2007-gameresbrowser
zbychs at users.sourceforge.net
zbychs at users.sourceforge.net
Thu Jul 5 18:45:51 CEST 2007
Revision: 27925
http://scummvm.svn.sourceforge.net/scummvm/?rev=27925&view=rev
Author: zbychs
Date: 2007-07-05 09:45:51 -0700 (Thu, 05 Jul 2007)
Log Message:
-----------
Still hunting segfaults...
Modified Paths:
--------------
scummex/branches/gsoc2007-gameresbrowser/gcc/Makefile
scummex/branches/gsoc2007-gameresbrowser/src/core/pinslot.cpp
scummex/branches/gsoc2007-gameresbrowser/src/core/pinslot.h
scummex/branches/gsoc2007-gameresbrowser/src/gui/DirectoryPresenter.cpp
scummex/branches/gsoc2007-gameresbrowser/src/gui/MainForm.cpp
scummex/branches/gsoc2007-gameresbrowser/src/gui/Test1.cpp
scummex/branches/gsoc2007-gameresbrowser/src/gui/VirtualNode.cpp
Added Paths:
-----------
scummex/branches/gsoc2007-gameresbrowser/gcc/mkdot.sh
Modified: scummex/branches/gsoc2007-gameresbrowser/gcc/Makefile
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/gcc/Makefile 2007-07-05 15:03:32 UTC (rev 27924)
+++ scummex/branches/gsoc2007-gameresbrowser/gcc/Makefile 2007-07-05 16:45:51 UTC (rev 27925)
@@ -6,7 +6,7 @@
#
###########################################################################################
-.PHONY : tell dep all clean copy_data core plugins gui clean_data clean_core clean_plugins clean_gui core_dir plugins_dir gui_dir
+.PHONY : pure debug dots tell dep all clean copy_data core plugins gui clean_data clean_core clean_plugins clean_gui core_dir plugins_dir gui_dir
###########################################################################################
@@ -58,19 +58,34 @@
else
WX_DEBUG = no
endif
+ifeq ($(MAKE_UNICODE), no)
+ WX_UNICODE = no
+else
+ WX_UNICODE = yes
+endif
+
WX_VERSION = 2.8
-WX_FLAGS = $(shell wx-config --version=$(WX_VERSION) --debug=$(WX_DEBUG) --cxxflags)
-WX_LIBS = $(shell wx-config --version=$(WX_VERSION) --debug=$(WX_DEBUG) --libs)
+WX_CONFIG = wx-config
+#WX_CONFIG = /usr/bin/wx-config
+WX_OPTS = --version=$(WX_VERSION) --debug=$(WX_DEBUG) --unicode=$(WX_UNICODE)
+WX_FLAGS = $(shell $(WX_CONFIG) $(WX_OPTS) --cxxflags)
+WX_LIBS = $(shell $(WX_CONFIG) $(WX_OPTS) --libs)
###########################################################################################
+ifeq ($(MAKE_PURE), yes)
+ PURE = NO_BOBJECTS
+else
+ PURE =
+endif
+
ifeq ($(MAKE_DEBUG), yes)
TELL = DEBUG BUILD
- GLOBAL_DEFINES = _DEBUG UNIX
+ GLOBAL_DEFINES = _DEBUG UNIX $(PURE)
else
TELL = RELEASE BUILD
- GLOBAL_DEFINES = NDEBUG UNIX
-# GLOBAL_DEFINES = UNIX
+# GLOBAL_DEFINES = NDEBUG UNIX $(PURE)
+ GLOBAL_DEFINES = UNIX $(PURE)
endif
BASE_FLAGS = -g $(patsubst %, -I%, $(HEADERS_DIRS) ) $(patsubst %, -D%, $(GLOBAL_DEFINES) )
@@ -86,6 +101,15 @@
tell:
echo '$(TELL)'
+dots:
+ mkdots.sh
+
+pure:
+ $(MAKE) all MAKE_PURE=yes
+
+debug:
+ $(MAKE) all MAKE_DEBUG=yes
+
###########################################################################################
dep:
Added: scummex/branches/gsoc2007-gameresbrowser/gcc/mkdot.sh
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/gcc/mkdot.sh (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/gcc/mkdot.sh 2007-07-05 16:45:51 UTC (rev 27925)
@@ -0,0 +1,11 @@
+#!/bin/bash
+#rem dot -T ps -o gc.ps gc.dot
+
+#for %%F in (*.dot) do dot -Tgif -Gsize=7.5,5 -o %%~dpnF.gif %%F
+
+dot -Tgif -o rootObjectChain.gif out/gui/rootObjectChain.dot
+
+#for name in out/gui/*.dot
+#do
+# dot -Tgif -o %%~dpnF.gif %%F
+#done
Property changes on: scummex/branches/gsoc2007-gameresbrowser/gcc/mkdot.sh
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: scummex/branches/gsoc2007-gameresbrowser/src/core/pinslot.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/core/pinslot.cpp 2007-07-05 15:03:32 UTC (rev 27924)
+++ scummex/branches/gsoc2007-gameresbrowser/src/core/pinslot.cpp 2007-07-05 16:45:51 UTC (rev 27925)
@@ -153,21 +153,23 @@
}
void InitializedObjects::registerObject(BObject* obj) {
- std::set<BObject*>::const_iterator i;
- i = _initializedObjects.find(obj);
- ASSERT(i == _initializedObjects.end());
+ ASSERT(!isValid(obj));
_initializedObjects.insert(obj);
}
void InitializedObjects::unregisterObject(BObject* obj) {
- std::set<BObject*>::const_iterator i;
- i = _initializedObjects.find(obj);
- ASSERT(i != _initializedObjects.end());
+ ASSERT(isValid(obj));
_initializedObjects.erase(obj);
}
+bool InitializedObjects::isValid(BObject* obj) {
+ std::set<BObject*>::const_iterator i;
+ i = _initializedObjects.find(obj);
+ return i != _initializedObjects.end();
+}
+
void InitializedObjects::report() {
std::cout << "------------ DUMPING INITIALIZED OBJECTS -------------" << std::endl;
std::cout << "OBJECTS COUNT: " << _initializedObjects.size() << std::endl;
Modified: scummex/branches/gsoc2007-gameresbrowser/src/core/pinslot.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/core/pinslot.h 2007-07-05 15:03:32 UTC (rev 27924)
+++ scummex/branches/gsoc2007-gameresbrowser/src/core/pinslot.h 2007-07-05 16:45:51 UTC (rev 27925)
@@ -346,6 +346,9 @@
/////////////////////////////////////////////////////////////////////////////
// For debug:
+#define ASSERT_VALID(obj) \
+ ASSERT( InitializedObjects::get()->isValid(obj) )
+
class BObject;
class InitializedObjects {
@@ -360,6 +363,7 @@
void registerObject(BObject* obj);
void unregisterObject(BObject* obj);
+ bool isValid(BObject* obj);
void report();
};
Modified: scummex/branches/gsoc2007-gameresbrowser/src/gui/DirectoryPresenter.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/DirectoryPresenter.cpp 2007-07-05 15:03:32 UTC (rev 27924)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/DirectoryPresenter.cpp 2007-07-05 16:45:51 UTC (rev 27925)
@@ -58,6 +58,7 @@
}
void DirectoryPresenter::doUnrealize(ObjectChain* ochain) {
+ ASSERT(_inodeprovider && _inodeprovider->getNode());
std::cout << "DirectoryPresenter::unrealize(): "
<< (_inodeprovider ? toString(_inodeprovider->getNode()->getTreeItemName()) : "<error>") << " "
<< (_idirectory ? _idirectory->getName() : "<not expanded>") << " "
Modified: scummex/branches/gsoc2007-gameresbrowser/src/gui/MainForm.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/MainForm.cpp 2007-07-05 15:03:32 UTC (rev 27924)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/MainForm.cpp 2007-07-05 16:45:51 UTC (rev 27925)
@@ -13,6 +13,12 @@
#include <fstream>
+#ifdef NO_BOBJECTS
+ #undef NO_BOBJECTS
+#endif
+
+#ifndef NO_BOBJECTS
+
#include "ExplorationTree.h"
#include "ftregistry.h"
#include "oregistry.h"
@@ -20,6 +26,8 @@
#include "safe_static.h"
+#endif
+
#include "debugmem.h"
using namespace Browser;
@@ -61,13 +69,17 @@
mainPanel->SetSize( wxSize(400, 300) );
Layout();
+#ifndef NO_BOBJECTS
ExplorationTree::initialize(browserTree, browserNotebook);
+#endif
char* leak = new char[5]; // a deliberate memory leak
leak[0] = 'L'; leak[1] = 'E'; leak[2] = 'A'; leak[3] = 'K'; leak[4] = '\0';
}
void MainForm::ZCleanup() {
+
+#ifndef NO_BOBJECTS
InitializedObjects::get()->report();
ExplorationTree::release();
@@ -82,6 +94,8 @@
InitializedObjects::release();
set_statics_not_allowed();
+#endif
+
}
MainForm::~MainForm() {
@@ -161,14 +175,18 @@
* browserTreeItemActivated
*/
void MainForm::browserTreeItemActivated(wxTreeEvent& event) {
+#ifndef NO_BOBJECTS
ExplorationTree::get()->itemActivated(event.GetItem());
+#endif
}
/*
* browserTreeItemExpanding
*/
void MainForm::browserTreeItemExpanding(wxTreeEvent& event) {
+#ifndef NO_BOBJECTS
ExplorationTree::get()->itemExpanded(event.GetItem());
+#endif
}
/*
Modified: scummex/branches/gsoc2007-gameresbrowser/src/gui/Test1.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/Test1.cpp 2007-07-05 15:03:32 UTC (rev 27924)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/Test1.cpp 2007-07-05 16:45:51 UTC (rev 27925)
@@ -13,11 +13,14 @@
#include "wx/filename.h"
+#include <iostream>
#include <fstream>
#include "plugin.h"
#include "oregistry.h"
+//#ifndef NO_BOBJECTS
+
#include "ExplorationTree.h"
#include "VirtualNode.h"
@@ -29,6 +32,8 @@
#include "PanelProvider.h"
#include "FileTypeRecognizer.h"
+//#endif
+
#include "debugmem.h"
using namespace Browser;
@@ -36,6 +41,8 @@
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
+//#ifndef NO_BOBJECTS
+
PLUGIN_DESC(Test1Plugin, "MyPlugins", 1)
//PLUGGED_OBJECT(RootDirectory)
PLUGGED_OBJECT(DirectoryPresenter)
@@ -50,11 +57,19 @@
PLUGGED_OBJECT(BMPFileTypeParserResolver)
PLUGIN_END_EX(Test1Plugin)
+//#endif
+
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void MainForm::OnTest1(wxCommandEvent& event) {
+
OnTest1Cleanup(event);
+
+ std::cout << "Registering Test1 Plugin." << std::endl;
+ ObjectRegistry::get()->registerPlugin( &getTest1Plugin, true );
+
+#ifndef NO_BOBJECTS
wxTreeItemId rootItem = ExplorationTree::_getTree()->
AddRoot(_T("RootDirectory"), -1, -1, NULL);
@@ -80,7 +95,6 @@
if (foxes.IsOk() && foxes.FileExists() && foxes.IsFileReadable())
rootDir->addFile("Foxes", toString(foxes.GetFullPath()));
- ObjectRegistry::get()->registerPlugin( &getTest1Plugin, true );
ObjectChain* rootChain = ExplorationTree::get()->getRootObjectChain();
rootChain->addObject(rootDir);
@@ -99,15 +113,19 @@
}
//Layout();
+#endif
+
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void MainForm::OnTest1Cleanup(wxCommandEvent& event) {
+#ifndef NO_BOBJECTS
ExplorationTree::_getTree()->DeleteAllItems();
ObjectChain* rootChain = ExplorationTree::get()->getRootObjectChain();
rootChain->removeAllObjects();
+#endif
}
@@ -116,6 +134,7 @@
void MainForm::OnDumpRootObjectChain(wxCommandEvent& event)
{
+//#ifndef NO_BOBJECTS
ObjectChain* rootChain = ExplorationTree::get()->getRootObjectChain();
ASSERT(rootChain);
@@ -124,11 +143,13 @@
if (file.fail()) {
wxMessageBox(_T("Could not create file: rootObjectChain.dot."), _T("DumpRootObjectChain Failed"),
wxOK | wxICON_ERROR, this);
+ return;
}
rootChain->dumpObjectChainStart("RootObjectChain", file);
wxMessageBox(_T("Dumped to rootObjectChain.dot."), _T("DumpRootObjectChain"),
wxOK | wxICON_INFORMATION, this);
+//#endif
}
/////////////////////////////////////////////////////////////////////////////
Modified: scummex/branches/gsoc2007-gameresbrowser/src/gui/VirtualNode.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/VirtualNode.cpp 2007-07-05 15:03:32 UTC (rev 27924)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/VirtualNode.cpp 2007-07-05 16:45:51 UTC (rev 27925)
@@ -43,6 +43,7 @@
virtual VirtualNode* getNode() {
std::cout << "INodeProviderImpl::getNode()" << std::endl;
+ ASSERT_VALID(_node);
return _node;
}
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list