FreeOrion

Forums for the FreeOrion project
It is currently Mon May 20, 2013 1:43 am

All times are UTC




Post new topic Reply to topic  [ 52 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject:
PostPosted: Sat Mar 10, 2007 11:22 am 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 7887
Location: Vancouver, BC
loonycyborg wrote:
Now it crashes when I drag any ship to new fleet :( .

Previously, was it only dragging the last ship out of a fleet that caused the crash, but now any fleet does so?

Edit: Could you make these changes, recompile and run? This should help narrow down where and why the crash is happening...

Code:
Index: universe/Fleet.cpp
===================================================================
--- universe/Fleet.cpp   (revision 2022)
+++ universe/Fleet.cpp   (working copy)
@@ -215,6 +215,7 @@

void Fleet::AddShip(const int ship_id)
{
+    Logger().errorStream() << "Fleet::AddShip(" << ship_id << ")";
     if (Ship* s = GetUniverse().Object<Ship>(ship_id)) {
         if (Fleet* old_fleet = s->GetFleet()) {
             old_fleet->RemoveShip(ship_id);
Index: util/Order.cpp
===================================================================
--- util/Order.cpp   (revision 2023)
+++ util/Order.cpp   (working copy)
@@ -118,7 +118,7 @@
     m_position(std::make_pair(UniverseObject::INVALID_POSITION, UniverseObject::INVALID_POSITION)),
     m_ship_ids(ship_ids)
{
-#if DEBUG_CREATE_FLEET_ORDER
+//#if DEBUG_CREATE_FLEET_ORDER
     std::cerr << "NewFleetOrder(int empire, const std::string& fleet_name, const int new_id, int system_id, int ship_id) : \n"
               << "    m_empire=" << EmpireID() << "\n"
               << "    m_fleet_name=" << m_fleet_name << "\n"
@@ -127,7 +127,7 @@
               << "    m_new_id=" << m_new_id << "\n"
               << "    m_ship_ids.size()=" << m_ship_ids.size() << "\n"
               << std::endl;
-#endif
+//#endif
}

NewFleetOrder::NewFleetOrder(int empire, const std::string& fleet_name,  const int new_id, double x, double y, const std::vector<int>& ship_ids) :
@@ -138,7 +138,7 @@
     m_position(std::make_pair(x, y)),
     m_ship_ids(ship_ids)
{
-#if DEBUG_CREATE_FLEET_ORDER
+//#if DEBUG_CREATE_FLEET_ORDER
     std::cerr << "NewFleetOrder(int empire, const std::string& fleet_name,  const int new_id, double x, double y, int ship_id : \n"
               << "    m_empire=" << EmpireID() << "\n"
               << "    m_fleet_name=" << m_fleet_name << "\n"
@@ -147,11 +147,13 @@
               << "    m_new_id=" << m_new_id << "\n"
               << "    m_ship_ids.size()=" << m_ship_ids.size() << "\n"
               << std::endl;
-#endif
+//#endif
}

void NewFleetOrder::ExecuteImpl() const
{
+    Logger().errorStream() << "NewFleetOrder::ExecuteImpl()";
+
     ValidateEmpireID();

     Universe& universe = GetUniverse();
Index: UI/SidePanel.cpp
===================================================================
--- UI/SidePanel.cpp   (revision 2023)
+++ UI/SidePanel.cpp   (working copy)
@@ -1504,6 +1504,8 @@

void SidePanel::FleetsChanged()
{
+    for(int i = 0; i < m_planet_panel_container->PlanetPanels(); i++)    
+        m_planet_panel_container->GetPlanetPanel(i)->Refresh();
}

void SidePanel::UpdateSystemResourceSummary()
Index: UI/FleetWnd.cpp
===================================================================
--- UI/FleetWnd.cpp   (revision 2023)
+++ UI/FleetWnd.cpp   (working copy)
@@ -371,6 +371,7 @@
         }
     }
     if (wnds.front()->DragDropDataType() == SHIP_DROP_TYPE_STRING) {
+        Logger().errorStream() << "FleetDataPanel::AcceptDrops.  Signaling NewFleetFromShipsSignal(" << ships[0]->Name() << ", ...)";
         NewFleetFromShipsSignal(ships[0], ship_ids);
     }
     wnds.clear();
@@ -748,6 +749,7 @@

void FleetDetailPanel::SetFleet(Fleet* fleet)
{
+    Logger().errorStream() << "FleetDetailPanel::SetFleet(Fleet* fleet)";
     Fleet* old_fleet = m_fleet;
     if (fleet != old_fleet)
         m_fleet_connection.disconnect();
@@ -798,6 +800,7 @@

void FleetDetailPanel::Refresh()
{
+    Logger().errorStream() << "FleetDetailPanel::Refresh()";
     SetFleet(m_fleet);
}

@@ -1223,6 +1226,10 @@

void FleetWnd::CreateNewFleetFromDrops(Ship* first_ship, const std::vector<int>& ship_ids)
{
+    Logger().errorStream() << "FleetWnd::CreateNewFleetFromDrops.  ids: ";
+    for (std::vector<int>::const_iterator it = ship_ids.begin(); it != ship_ids.end(); ++it)
+        Logger().errorStream() << ".. " << *it;
+
     Fleet* some_fleet = FleetInRow(0);

     // special case: disallow creating a new fleet from a ship when there is exactly 1 fleet containing exactly 1 ship
@@ -1250,10 +1257,11 @@

     Fleet* new_fleet = 0;
     if (system) {
+        Logger().errorStream() << "FleetWnd::CreateNewFleetFromDrops: Issuing NewFleetOrder at system with id: " << system->ID();
         HumanClientApp::GetApp()->Orders().IssueOrder(new NewFleetOrder(empire_id, fleet_name, new_fleet_id, system->ID(), ship_ids));
         System::ObjectVec fleets = system->FindObjectsInOrbit(-1, StationaryFleetVisitor(empire_id));
         for (unsigned int i = 0; i < fleets.size(); ++i) {
-            if (fleets[i]->Name() == fleet_name) {
+            if (fleets[i]->ID() == new_fleet_id) {
                 new_fleet = universe_object_cast<Fleet*>(fleets[i]);
                 break;
             }


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 10, 2007 10:49 pm 
Offline
Compilation Expert
User avatar

Joined: Thu Jul 06, 2006 10:30 pm
Posts: 219
Location: Russia/Moscow
Geoff the Medio wrote:
Previously, was it only dragging the last ship out of a fleet that caused the crash, but now any fleet does so?

Yes, but not always. Sometimes(rarely) dragging a ship doesn't cause a crash.

Quote:
Edit: Could you make these changes, recompile and run? This should help narrow down where and why the crash is happening...


Code:
1173566793 DEBUG  : Generated AI Orders, starting turn update
1173566793 DEBUG  : Done dealing with turn update message
1173566800 ERROR  : FleetDetailPanel::SetFleet(Fleet* fleet)
1173566800 ERROR  : FleetDetailPanel::SetFleet(Fleet* fleet)
1173566800 ERROR  : FleetDetailPanel::SetFleet(Fleet* fleet)
    I drag a ship to new fleet
1173566848 ERROR  : FleetDataPanel::AcceptDrops.  Signaling NewFleetFromShipsSignal(Scout, ...)
1173566848 ERROR  : FleetWnd::CreateNewFleetFromDrops.  ids:
1173566848 ERROR  : .. 563
1173566848 ERROR  : FleetWnd::CreateNewFleetFromDrops: Issuing NewFleetOrder at system with id: 73
NewFleetOrder(int empire, const std::string& fleet_name, const int new_id, int system_id, int ship_id) :
    m_empire=0
    m_fleet_name=New fleet590
    m_system_id=73
    m_position=(-100000 -100000)
    m_new_id=590
    m_ship_ids.size()=1

1173566848 ERROR  : NewFleetOrder::ExecuteImpl()
1173566848 ERROR  : Fleet::AddShip(563)
1173566848 ERROR  : FleetDetailPanel::Refresh()
1173566848 ERROR  : FleetDetailPanel::SetFleet(Fleet* fleet)
1173566848 FATAL  : Initiating Exit (code 1 - error termination)
Ошибка сегментирования


EDIT: Here's a backtrace:
Code:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1233545520 (LWP 10354)]
0x080cc39d in std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::begin (this=0x4c)
    at /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/bits/stl_tree.h:599
599                                   (this->_M_impl._M_header._M_left));
(gdb) up
#1  0x080cc3d2 in std::set<int, std::less<int>, std::allocator<int> >::begin (
    this=0x4c)
    at /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/bits/stl_set.h:245
245           { return _M_t.begin(); }
(gdb) up
#2  0x081bb751 in Ship::Design (this=0x18) at universe/Ship.cpp:35
35          return GetShipDesign(*Owners().begin(), m_design_name);
(gdb) up
#3  0x083653a1 in (anonymous namespace)::ShipDataPanel::Refresh (this=0x8a8fa78)
    at UI/FleetWnd.cpp:170
170                 const ShipDesign* design = m_ship->Design();
(gdb) up
#4  0x08354732 in boost::_mfi::mf0<void, (anonymous namespace)::ShipDataPanel>::operator() (this=0x8a8fe88, p=0x8a8fa78)
    at /usr/include/boost/bind/mem_fn_template.hpp:45
45              BOOST_MEM_FN_RETURN (p->*f_)();
(gdb) up
#5  0x08355328 in boost::_bi::list1<boost::_bi::value<(anonymous namespace)::ShipDataPanel*> >::operator()<boost::_mfi::mf0<void, (anonymous namespace)::ShipDataPanel>, boost::_bi::list0> (this=0x8a8fe90, f=@0x8a8fe88, a=@0xbfa2e936)
    at /usr/include/boost/bind.hpp:230
230             unwrap(&f, 0)(a[a1_]);


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 12, 2007 6:12 pm 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 7887
Location: Vancouver, BC
Ok, next round.

I've made more changes to FleetWnd.cpp and Fleet.cpp, and the new versions of the files are here and here. Could you replace, recompile, start a game, click the fleetbutton, drag a ship from the home fleet onto new fleet, and tell me what happens and post the debug output? The backtrace hasn't been helpful, but post it if you want.

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 12, 2007 11:38 pm 
Offline
Compilation Expert
User avatar

Joined: Thu Jul 06, 2006 10:30 pm
Posts: 219
Location: Russia/Moscow
I've got a compiler error:
Code:
ccache g++ -pthread -Wall -g -O0 -DFREEORION_LINUX -DENABLE_BINRELOC -DFREEORION_BUILD_HUMAN -I/usr/include/SDL -I/usr/local/include -I/usr/include/graphviz -I/usr/include/graphviz -c -o UI/FleetWnd-human.o UI/FleetWnd.cpp
UI/FleetWnd.cpp: In member function 'void FleetDataPanel::SetFleetIcon()':
UI/FleetWnd.cpp:426: error: 'ShipIcon' is not a member of 'ClientUI'
scons: *** [UI/FleetWnd-human.o] Error 1
scons: building terminated because of errors.

Maybe it's wrong version of FleetWnd.cpp? Now I have revision 2027.

IMHO the backtrace shows that a destroyed instance of ShipDataPanel received a signal.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 2:02 am 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 7887
Location: Vancouver, BC
loonycyborg wrote:
I've got a compiler error:
[...]
Maybe it's wrong version of FleetWnd.cpp? Now I have revision 2027.

No, it's me making other changes that I haven't commited yet, but missing one when removing them to send to you.

On line 426, replace

ClientUI::ShipIcon(design_name)

with

ClientUI::GetTexture(ClientUI::ArtDir() / "icons" / (design_name + ".png"))

and that should fix the compile problem.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 13, 2007 9:25 am 
Offline
Compilation Expert
User avatar

Joined: Thu Jul 06, 2006 10:30 pm
Posts: 219
Location: Russia/Moscow
Code:
1173777269 DEBUG  : Generated AI Orders, starting turn update
1173777269 DEBUG  : Done dealing with turn update message
1173777279 ERROR  : FleetDetailPanel::FleetDetailPanel(...) fleet: (null) this: 0x886a150
1173777279 ERROR  : FleetDetailPanel::FleetDetailPanel(...) done
1173777279 ERROR  : FleetDetailPanel::SetFleet() fleet id (null), this: 0x886a150
1173777279 ERROR  : FleetDetailPanel::SetFleet() fleet id: 562 this: 0x886a150
1173777279 ERROR  : FleetDetailPanel::SetFleet() connecting StateChangedSignal() for fleet 562 to FleetDetailPanel::Refresh : 0x886a150
   I drag the second scout to new fleet
1173777294 ERROR  : FleetDataPanel::AcceptDrops.  Signaling NewFleetFromShipsSignal(Scout, ...)
1173777294 ERROR  : FleetWnd::CreateNewFleetFromDrops.  ship ids:
1173777294 ERROR  : .. 564
1173777294 ERROR  : FleetWnd::CreateNewFleetFromDrops: Issuing NewFleetOrder at system with id: 73
NewFleetOrder(int empire, const std::string& fleet_name, const int new_id, int system_id, int ship_id) :
    m_empire=0
    m_fleet_name=New fleet590
    m_system_id=73
    m_position=(-100000 -100000)
    m_new_id=590
    m_ship_ids.size()=1

1173777294 ERROR  : NewFleetOrder::ExecuteImpl()
1173777294 ERROR  : Fleet::AddShip(564)
1173777294 ERROR  : Fleet::RemoveShip fleet id: 562 emitting StateChangedSignal()
1173777294 ERROR  : FleetDetailPanel::Refresh() : this:0x886a150
1173777294 ERROR  : FleetDetailPanel::SetFleet() fleet id: 562 this: 0x886a150
1173777294 FATAL  : Initiating Exit (code 1 - error termination)
Ошибка сегментирования


Code:
1173777609 DEBUG  : Generated AI Orders, starting turn update
1173777609 DEBUG  : Done dealing with turn update message
1173777612 ERROR  : FleetDetailPanel::FleetDetailPanel(...) fleet: (null) this: 0x88691b0
1173777612 ERROR  : FleetDetailPanel::FleetDetailPanel(...) done
1173777612 ERROR  : FleetDetailPanel::SetFleet() fleet id (null), this: 0x88691b0
1173777612 ERROR  : FleetDetailPanel::SetFleet() fleet id: 562 this: 0x88691b0
1173777612 ERROR  : FleetDetailPanel::SetFleet() connecting StateChangedSignal() for fleet 562 to FleetDetailPanel::Refresh : 0x88691b0
   I drag the first scout to new fleet
1173777634 ERROR  : FleetDataPanel::AcceptDrops.  Signaling NewFleetFromShipsSignal(Scout, ...)
1173777634 ERROR  : FleetWnd::CreateNewFleetFromDrops.  ship ids:
1173777634 ERROR  : .. 563
1173777634 ERROR  : FleetWnd::CreateNewFleetFromDrops: Issuing NewFleetOrder at system with id: 73
NewFleetOrder(int empire, const std::string& fleet_name, const int new_id, int system_id, int ship_id) :
    m_empire=0
    m_fleet_name=New fleet590
    m_system_id=73
    m_position=(-100000 -100000)
    m_new_id=590
    m_ship_ids.size()=1

1173777634 ERROR  : NewFleetOrder::ExecuteImpl()
1173777634 ERROR  : Fleet::AddShip(563)
1173777634 ERROR  : Fleet::RemoveShip fleet id: 562 emitting StateChangedSignal()
1173777634 ERROR  : FleetDetailPanel::Refresh() : this:0x88691b0
1173777634 ERROR  : FleetDetailPanel::SetFleet() fleet id: 562 this: 0x88691b0
1173777634 ERROR  : Fleet::AddShip fleet id: 590 emitting StateChangedSignal()
   No crash this time; I drag the other scout
1173777783 ERROR  : FleetDataPanel::AcceptDrops.  Signaling NewFleetFromShipsSignal(Scout, ...)
1173777783 ERROR  : FleetWnd::CreateNewFleetFromDrops.  ship ids:
1173777783 ERROR  : .. 564
1173777783 ERROR  : FleetWnd::CreateNewFleetFromDrops: Issuing NewFleetOrder at system with id: 73
NewFleetOrder(int empire, const std::string& fleet_name, const int new_id, int system_id, int ship_id) :
    m_empire=0
    m_fleet_name=New fleet591
    m_system_id=73
    m_position=(-100000 -100000)
    m_new_id=591
    m_ship_ids.size()=1

1173777783 ERROR  : NewFleetOrder::ExecuteImpl()
1173777783 ERROR  : Fleet::AddShip(564)
1173777783 ERROR  : Fleet::RemoveShip fleet id: 562 emitting StateChangedSignal()
1173777783 ERROR  : FleetDetailPanel::Refresh() : this:0x88691b0
1173777783 ERROR  : FleetDetailPanel::SetFleet() fleet id: 562 this: 0x88691b0
1173777783 FATAL  : Initiating Exit (code 1 - error termination)
Ошибка сегментирования


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 17, 2007 10:14 pm 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 7887
Location: Vancouver, BC
I've updated FleetWnd.cpp. The new version is again here. Could you again replace, recompile, retest and post results? Thanks again.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 18, 2007 8:46 am 
Offline
Compilation Expert
User avatar

Joined: Thu Jul 06, 2006 10:30 pm
Posts: 219
Location: Russia/Moscow
Now crashes occur only if I open and close fleet window at least once.

Code:
1174206951 DEBUG  : Generated AI Orders, starting turn update
1174206951 DEBUG  : Done dealing with turn update message
    I open fleet window
1174207038 ERROR  : FleetDetailPanel::FleetDetailPanel(...) fleet: (null) this: 0x886a4b0
1174207038 ERROR  : FleetDetailPanel::FleetDetailPanel(...) done
1174207038 ERROR  : FleetDetailPanel::SetFleet() fleet id (null), this: 0x886a4b0
1174207038 ERROR  : FleetDetailPanel::SetFleet() did not disconnect StateChangedSignal because old fleet is: 0
1174207038 ERROR  : blanking destination text and status text
1174207038 ERROR  : clearing ships listbox
1174207038 ERROR  : setting fleet of lixbox
1174207038 ERROR  : FleetDetailPanel::SetFleet() fleet id: 562 this: 0x886a4b0
1174207038 ERROR  : FleetDetailPanel::SetFleet() did not disconnect StateChangedSignal because old fleet is: 0
1174207038 ERROR  : blanking destination text and status text
1174207038 ERROR  : clearing ships listbox
1174207038 ERROR  : setting fleet of lixbox
1174207038 ERROR  : have a new fleet, so ... hmm
1174207038 ERROR  : ShipDataPanel::ShipDataPanel() connection ship 563 StateChangedSignal to this->Refresh().  this: 0x8a7d9c0
1174207038 ERROR  : ShipDataPanel::ShipDataPanel() connection ship 564 StateChangedSignal to this->Refresh().  this: 0x8a89e30
1174207038 ERROR  : ShipDataPanel::ShipDataPanel() connection ship 565 StateChangedSignal to this->Refresh().  this: 0x8a8ed60
1174207038 ERROR  : FleetDetailPanel::SetFleet() connecting StateChangedSignal() for fleet 562 to FleetDetailPanel::Refresh : 0x886a4b0
    I close fleet window
1174207074 ERROR  : FleetDetailPanel::~FleetDetailPanel() DISconnecting StateChangedSignal() for fleet 562 to FleetDetailPanel::Refresh : 0x886a4b0
1174207074 ERROR  : ShipDataPanel::~ShipDataPanel() DISconnection ship 563 StateChangedSignal.  this: 0x8a7d9c0
1174207074 ERROR  : ShipDataPanel::~ShipDataPanel() DISconnection ship 564 StateChangedSignal.  this: 0x8a89e30
1174207074 ERROR  : ShipDataPanel::~ShipDataPanel() DISconnection ship 565 StateChangedSignal.  this: 0x8a8ed60
    I open fleet window again
1174207112 ERROR  : FleetDetailPanel::FleetDetailPanel(...) fleet: (null) this: 0x8a79940
1174207112 ERROR  : FleetDetailPanel::FleetDetailPanel(...) done
1174207112 ERROR  : FleetDetailPanel::SetFleet() fleet id (null), this: 0x8a79940
1174207112 ERROR  : FleetDetailPanel::SetFleet() did not disconnect StateChangedSignal because old fleet is: 0
1174207112 ERROR  : blanking destination text and status text
1174207112 ERROR  : clearing ships listbox
1174207112 ERROR  : setting fleet of lixbox
1174207112 ERROR  : FleetDetailPanel::SetFleet() fleet id: 562 this: 0x8a79940
1174207112 ERROR  : FleetDetailPanel::SetFleet() did not disconnect StateChangedSignal because old fleet is: 0
1174207112 ERROR  : blanking destination text and status text
1174207112 ERROR  : clearing ships listbox
1174207112 ERROR  : setting fleet of lixbox
1174207112 ERROR  : have a new fleet, so ... hmm
1174207112 ERROR  : ShipDataPanel::ShipDataPanel() connection ship 563 StateChangedSignal to this->Refresh().  this: 0x8a8e438
1174207112 ERROR  : ShipDataPanel::ShipDataPanel() connection ship 564 StateChangedSignal to this->Refresh().  this: 0x8a8e968
1174207112 ERROR  : ShipDataPanel::ShipDataPanel() connection ship 565 StateChangedSignal to this->Refresh().  this: 0x8868c70
1174207112 ERROR  : FleetDetailPanel::SetFleet() connecting StateChangedSignal() for fleet 562 to FleetDetailPanel::Refresh : 0x8a79940
    I drag a ship
1174207140 ERROR  : FleetDataPanel::AcceptDrops.  Signaling NewFleetFromShipsSignal(Scout, ...)
1174207140 ERROR  : FleetWnd::CreateNewFleetFromDrops.  ship ids:
1174207140 ERROR  : .. 564
1174207140 ERROR  : FleetWnd::CreateNewFleetFromDrops: Issuing NewFleetOrder at system with id: 73
NewFleetOrder(int empire, const std::string& fleet_name, const int new_id, int system_id, int ship_id) :
    m_empire=0
    m_fleet_name=New fleet590
    m_system_id=73
    m_position=(-100000 -100000)
    m_new_id=590
    m_ship_ids.size()=1

1174207140 ERROR  : NewFleetOrder::ExecuteImpl()
1174207140 FATAL  : Initiating Exit (code 1 - error termination)
Ошибка сегментирования


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 18, 2007 6:20 pm 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 7887
Location: Vancouver, BC
I've updated FleetWnd.cpp and FleetWnd.h with a bunch more manual signal disconnections... Give it another go? Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 18, 2007 9:08 pm 
Offline
Compilation Expert
User avatar

Joined: Thu Jul 06, 2006 10:30 pm
Posts: 219
Location: Russia/Moscow
I've got a screenful of compiler errors:
Code:
ccache g++ -pthread -Wall -g -O0 -DFREEORION_LINUX -DENABLE_BINRELOC -DFREEORION_BUILD_HUMAN -I/usr/include/SDL -I/usr/local/include -I/usr/include/graphviz -I/usr/include/graphviz -c -o UI/FleetWnd-human.o UI/FleetWnd.cpp
UI/FleetWnd.cpp: In constructor 'FleetWnd::FleetWnd(int, int, std::vector<Fleet*, std::allocator<Fleet*> >, int, bool, uint32_t)':
UI/FleetWnd.cpp:1029: error: 'm_system_changed_connection' was not declared in this scope
UI/FleetWnd.cpp: In member function 'virtual void FleetWnd::CloseClicked()':
UI/FleetWnd.cpp:1042: error: 'm_lb_delete_connection' was not declared in this scope
   etc...


Next time please post output of "svn diff" if you can. I have patch(1) and I know how to use it. :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 19, 2007 12:12 am 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 7887
Location: Vancouver, BC
Did you update FleetWnd.cpp properly? There's no "m_system_changed_connection" in the file I linked just above, though several were removed from previous versions. Maybe refresh your browser, in case it's caching the old version?

Anyway, here's the diff:

Code:
Index: FleetWnd.h
===================================================================
--- FleetWnd.h   (revision 2027)
+++ FleetWnd.h   (working copy)
@@ -14,11 +14,7 @@
class Ship;
class System;
class UniverseObject;
-namespace GG {
-    class TextControl;
-}

-
class FleetDetailWnd : public CUIWnd
{
public:
@@ -45,6 +41,8 @@
private:
     std::string TitleText() const;

+    boost::signals::connection m_panel_empty_connection;
+
     FleetDetailPanel* m_fleet_panel;
};

@@ -114,16 +112,15 @@
     int                 m_current_fleet;

     std::map<Fleet*, FleetDetailWnd*> m_open_fleet_detail_wnds;
-    std::map<FleetDetailWnd*, boost::signals::connection> m_open_fleet_detail_wnd_connections;

+    std::multimap<FleetDetailWnd*, boost::signals::connection>  m_open_fleet_detail_wnd_connections;
+    std::set<boost::signals::connection>                        m_misc_connections;
+
     FleetsListBox*      m_fleets_lb;
     FleetDataPanel*     m_new_fleet_drop_target;
     FleetDetailPanel*   m_fleet_detail_panel;

-    boost::signals::connection  m_lb_delete_connection;
-    boost::signals::connection  m_system_changed_connection;
-    std::vector<boost::signals::connection> m_misc_connections;
-
+   
     static GG::Pt s_last_position; ///< the latest position to which any FleetWnd has been moved.  This is used to keep the place of the fleet window in single-fleetwindow mode.
};

Index: FleetWnd.cpp
===================================================================
--- FleetWnd.cpp   (revision 2027)
+++ FleetWnd.cpp   (working copy)
@@ -38,7 +38,8 @@
     };

     FleetDataPanel(int w, int h, const Fleet* fleet, int empire = -1, int system_id = -1, double x = 0.0, double y = 0.0);
-
+    ~FleetDataPanel();
+   
     bool Selected() const;

     virtual void Render();
@@ -58,6 +59,9 @@
     const int m_system_id;
     const double m_x;
     const double m_y;
+
+    boost::signals::connection m_fleet_connection;
+
     GG::StaticGraphic* m_fleet_icon;
     GG::TextControl* m_fleet_name_text;
     StatisticIcon* m_num_ships_stat;
@@ -105,11 +109,18 @@
             m_ship_strength_stat = new StatisticIcon(h, SHIP_NAME_HT, STAT_ICON_WD, h - SHIP_NAME_HT - 1, (ClientUI::ArtDir() / "icons" / "combatstrength.png").native_file_string(),
                                                      ClientUI::TextColor(), 0, 0, true, false);
             AttachChild(m_ship_strength_stat);
-            GG::Connect(m_ship->StateChangedSignal, &ShipDataPanel::Refresh, this);
+            Logger().errorStream() << "ShipDataPanel::ShipDataPanel() connection ship " << m_ship->ID() << " StateChangedSignal to this->Refresh().  this: " << this;
+            m_ship_connection = GG::Connect(m_ship->StateChangedSignal, &ShipDataPanel::Refresh, this);

             Refresh();
         }

+        ~ShipDataPanel()
+        {
+            Logger().errorStream() << "ShipDataPanel::~ShipDataPanel() DISconnection ship " << m_ship->ID() << " StateChangedSignal.  this: " << this;
+            m_ship_connection.disconnect();
+        }
+
         virtual void Render()
         {
             const GG::Clr& unselected_color = GG::CLR_GRAY;
@@ -160,8 +171,7 @@
                 design_name = "Scout";
             }
             m_ship_icon = new GG::StaticGraphic(ICON_OFFSET, ICON_OFFSET, SHIP_ICON_SZ, SHIP_ICON_SZ,
-                                                ClientUI::GetTexture(ClientUI::ArtDir() / "icons" / (design_name + ".png")),
-                                                GG::GR_FITGRAPHIC);
+            /*ClientUI::ShipIcon(design_name)*/ ClientUI::GetTexture(ClientUI::ArtDir() / "icons" / (design_name + ".png")), GG::GR_FITGRAPHIC);
             AttachChild(m_ship_icon);
         }

@@ -207,6 +217,7 @@
         StatisticIcon* m_damage_stat;
         GG::StaticGraphic* m_colonizer_icon;
         bool m_selected;
+        boost::signals::connection m_ship_connection;
     };

     struct FleetRow : public GG::ListBox::Row
@@ -308,11 +319,16 @@
                                                   ClientUI::TextColor(), 0, 0, true, false);
         AttachChild(m_num_ships_stat);
         AttachChild(m_fleet_strength_stat);
-        GG::Connect(m_fleet->StateChangedSignal, &FleetDataPanel::Refresh, this);
+        m_fleet_connection = GG::Connect(m_fleet->StateChangedSignal, &FleetDataPanel::Refresh, this);
     }

     Refresh();
}
+   
+FleetDataPanel::~FleetDataPanel()
+{
+    m_fleet_connection.disconnect();
+}

bool FleetDataPanel::Selected() const
{
@@ -371,6 +387,7 @@
         }
     }
     if (wnds.front()->DragDropDataType() == SHIP_DROP_TYPE_STRING) {
+        Logger().errorStream() << "FleetDataPanel::AcceptDrops.  Signaling NewFleetFromShipsSignal(" << ships[0]->Name() << ", ...)";
         NewFleetFromShipsSignal(ships[0], ship_ids);
     }
     wnds.clear();
@@ -423,7 +440,7 @@
             } else {
                 design_name = "Scout";
             }
-            icon = ClientUI::GetTexture(ClientUI::ArtDir() / "icons" / (design_name + ".png"));
+            icon = ClientUI::ShipIcon(design_name);
         }
     } else { // the "new fleet" data panel
         icon = ClientUI::GetTexture(ClientUI::ArtDir() / "icons" / "newfleet.png");
@@ -495,6 +512,7 @@
{
public:
     FleetDetailPanel(Fleet* fleet, bool read_only, Uint32 flags = 0); ///< ctor
+    ~FleetDetailPanel();

     Fleet* GetFleet() const {return m_fleet;} ///< returns the currently-displayed fleet (may be 0)

@@ -516,6 +534,8 @@
     Fleet*                      m_fleet;
     const bool                  m_read_only;
     boost::signals::connection  m_fleet_connection;
+    std::set<boost::signals::connection>
+                                m_misc_connections;

     GG::TextControl*            m_destination_text;
     ShipsListBox*               m_ships_lb;
@@ -717,6 +737,11 @@
     m_ships_lb(0),
     m_ship_status_text(0)
{
+    if (fleet)
+        Logger().errorStream() << "FleetDetailPanel::FleetDetailPanel(...) fleet: " << fleet->ID() << " this: " << this;
+    else
+        Logger().errorStream() << "FleetDetailPanel::FleetDetailPanel(...) fleet: (null) this: " << this;
+
     SetText("FleetDetailPanel");
     EnableChildClipping(true);

@@ -735,12 +760,25 @@
     m_destination_text->SetMinSize(false);
     m_ship_status_text->SetMinSize(false);

-    SetFleet(fleet);
+    if (fleet) SetFleet(fleet);
     Init();

-    GG::Connect(GetUniverse().UniverseObjectDeleteSignal, &FleetDetailPanel::UniverseObjectDeleted, this);
+    m_misc_connections.insert(GG::Connect(GetUniverse().UniverseObjectDeleteSignal, &FleetDetailPanel::UniverseObjectDeleted, this));
+    Logger().errorStream() << "FleetDetailPanel::FleetDetailPanel(...) done";
}

+FleetDetailPanel::~FleetDetailPanel()
+{
+    if (m_fleet) {
+        Logger().errorStream() << "FleetDetailPanel::~FleetDetailPanel() DISconnecting StateChangedSignal() for fleet " << m_fleet->ID() << " to FleetDetailPanel::Refresh : " << this;
+        m_fleet_connection.disconnect();
+    }
+    while (!m_misc_connections.empty()) {
+        m_misc_connections.begin()->disconnect();
+        m_misc_connections.erase(m_misc_connections.begin());
+    }
+}
+
int FleetDetailPanel::GetShipIDOfListRow(int row_idx) const
{
     return dynamic_cast<ShipRow&>(m_ships_lb->GetRow(row_idx)).ShipID();
@@ -748,26 +786,47 @@

void FleetDetailPanel::SetFleet(Fleet* fleet)
{
+    if (fleet)
+        Logger().errorStream() << "FleetDetailPanel::SetFleet() fleet id: " << fleet->ID() << " this: " << this;
+    else
+        Logger().errorStream() << "FleetDetailPanel::SetFleet() fleet id (null), this: " << this;
+
     Fleet* old_fleet = m_fleet;
-    if (fleet != old_fleet)
+
+    if (old_fleet && old_fleet != fleet) {
+        Logger().errorStream() << "FleetDetailPanel::SetFleet() DISconnecting StateChangedSignal() for fleet " << m_fleet->ID();
         m_fleet_connection.disconnect();
+    } else {
+        Logger().errorStream() << "FleetDetailPanel::SetFleet() did not disconnect StateChangedSignal because old fleet is: " << old_fleet;
+    }
+
+    Logger().errorStream() << "blanking destination text and status text";
     *m_destination_text << "";
     *m_ship_status_text << "";
+    Logger().errorStream() << "clearing ships listbox";
     m_ships_lb->Clear();
+    Logger().errorStream() << "setting fleet of lixbox";
     m_ships_lb->SetFleet(fleet);
-    if ((m_fleet = fleet)) {
+   
+    m_fleet = fleet;
+
+    if (m_fleet) {
+        Logger().errorStream() << "have a new fleet, so ... hmm";
         Universe& universe = GetUniverse();
+
         if (m_fleet->NumShips()) {
-            for (Fleet::const_iterator it = m_fleet->begin(); it != m_fleet->end(); ++it) {
+            for (Fleet::const_iterator it = m_fleet->begin(); it != m_fleet->end(); ++it)
                 m_ships_lb->Insert(new ShipRow(universe.Object<Ship>(*it)));
-            }
+
         } else {
             PanelEmptySignal(m_fleet);
-            return; // return immediately, since the signal above may invalidate this
+            return; // return immediately, since PanelEmptySignal may invalidate this pointer
         }
+
         *m_destination_text << DestinationText();
-        if (fleet != old_fleet) {
-            m_fleet_connection.disconnect();
+
+        if (old_fleet != fleet) {
+            Logger().errorStream() << "FleetDetailPanel::SetFleet() connecting StateChangedSignal() for fleet " << m_fleet->ID() << " to FleetDetailPanel::Refresh : " << this;
             m_fleet_connection = GG::Connect(m_fleet->StateChangedSignal, &FleetDetailPanel::Refresh, this);
         }
     }
@@ -791,13 +850,14 @@
     GetLayout()->SetRowStretch(1, 1.0);
     GetLayout()->SetMinimumRowHeight(2, ClientUI::Pts() + 4);

-    GG::Connect(m_ships_lb->SelChangedSignal, &FleetDetailPanel::ShipSelectionChanged, this);
-    GG::Connect(m_ships_lb->BrowsedSignal, &FleetDetailPanel::ShipBrowsed, this);
-    GG::Connect(m_ships_lb->RightClickedSignal, &FleetDetailPanel::ShipRightClicked, this);
+    m_misc_connections.insert(GG::Connect(m_ships_lb->SelChangedSignal, &FleetDetailPanel::ShipSelectionChanged, this));
+    m_misc_connections.insert(GG::Connect(m_ships_lb->BrowsedSignal, &FleetDetailPanel::ShipBrowsed, this));
+    m_misc_connections.insert(GG::Connect(m_ships_lb->RightClickedSignal, &FleetDetailPanel::ShipRightClicked, this));
}

void FleetDetailPanel::Refresh()
{
+    Logger().errorStream() << "FleetDetailPanel::Refresh() : this:" << this;
     SetFleet(m_fleet);
}

@@ -902,11 +962,13 @@
     SetMaxSize(GG::Pt(Width(), MaxSize().y));
     SetText(TitleText());
     EnableChildClipping(false);
-    GG::Connect(m_fleet_panel->PanelEmptySignal, PanelEmptySignal);
+    m_panel_empty_connection = GG::Connect(m_fleet_panel->PanelEmptySignal, PanelEmptySignal);
}

FleetDetailWnd::~FleetDetailWnd()
{
+    Logger().errorStream() << "FleetDetailWnd::~FleetDetailWnd() : this: " << this;
+    m_panel_empty_connection.disconnect();
     ClosingSignal(m_fleet_panel->GetFleet());
}

@@ -977,23 +1039,40 @@
     EnableChildClipping(false);

     Init(fleets, selected_fleet);
-    GG::Connect(GetUniverse().UniverseObjectDeleteSignal, &FleetWnd::UniverseObjectDeleted, this);
+    m_misc_connections.insert(GG::Connect(GetUniverse().UniverseObjectDeleteSignal, &FleetWnd::UniverseObjectDeleted, this));

     if (const System* system = fleets.back()->GetSystem())
-        m_system_changed_connection = Connect(system->StateChangedSignal, &FleetWnd::SystemChangedSlot, this);
+        m_misc_connections.insert(Connect(system->StateChangedSignal, &FleetWnd::SystemChangedSlot, this));

     SetMaxSize(GG::Pt(Width(), MaxSize().y));
}

FleetWnd::~FleetWnd()
{
+    // disconnect all signals connect to the FleetWnd itself
+    while (!m_misc_connections.empty()) {
+        m_misc_connections.begin()->disconnect();
+        m_misc_connections.erase(m_misc_connections.begin());
+    }
+    // disconnect all signals attached to FleetDetailWnds
+    while (!m_open_fleet_detail_wnd_connections.empty()) {
+        m_open_fleet_detail_wnd_connections.begin()->second.disconnect();
+        m_open_fleet_detail_wnd_connections.erase(m_open_fleet_detail_wnd_connections.begin());
+    }
+    //std::multimap<FleetDetailWnd*, boost::signals::connection>::iterator sig_it = m_open_fleet_detail_wnd_connections.begin();
+    //while (sig_it != m_open_fleet_detail_wnd_connections.end()) {
+    //    sig_it->second.disconnect();
+    //    m_open_fleet_detail_wnd_connections.erase(sig_it);
+    //    sig_it = m_open_fleet_detail_wnd_connections.begin();
+    //}
+   
     ClientUI::GetClientUI()->GetMapWnd()->SetProjectedFleetMovement(0, std::list<System*>());
}

void FleetWnd::CloseClicked()
{
     s_last_position = UpperLeft();
-    m_lb_delete_connection.disconnect();
+   
     for (std::map<Fleet*, FleetDetailWnd*>::iterator it = m_open_fleet_detail_wnds.begin(); it != m_open_fleet_detail_wnds.end(); ++it) {
         delete it->second;
     }
@@ -1031,13 +1110,13 @@
     }
     GetLayout()->SetBorderMargin(7);

-    GG::Connect(m_fleet_detail_panel->PanelEmptySignal, &FleetWnd::DeleteFleet, this);
-    GG::Connect(m_fleets_lb->SelChangedSignal, &FleetWnd::FleetSelectionChanged, this);
-    GG::Connect(m_fleets_lb->RightClickedSignal, &FleetWnd::FleetRightClicked, this);
-    GG::Connect(m_fleets_lb->DoubleClickedSignal, &FleetWnd::FleetDoubleClicked, this);
-    m_lb_delete_connection = GG::Connect(m_fleets_lb->ErasedSignal, &FleetWnd::FleetDeleted, this);
+    m_misc_connections.insert(GG::Connect(m_fleet_detail_panel->PanelEmptySignal, &FleetWnd::DeleteFleet, this));
+    m_misc_connections.insert(GG::Connect(m_fleets_lb->SelChangedSignal, &FleetWnd::FleetSelectionChanged, this));
+    m_misc_connections.insert(GG::Connect(m_fleets_lb->RightClickedSignal, &FleetWnd::FleetRightClicked, this));
+    m_misc_connections.insert(GG::Connect(m_fleets_lb->DoubleClickedSignal, &FleetWnd::FleetDoubleClicked, this));
+    m_misc_connections.insert(GG::Connect(m_fleets_lb->ErasedSignal, &FleetWnd::FleetDeleted, this));
     if (!m_read_only)
-        GG::Connect(m_new_fleet_drop_target->NewFleetFromShipsSignal, &FleetWnd::CreateNewFleetFromDrops, this);
+        m_misc_connections.insert(GG::Connect(m_new_fleet_drop_target->NewFleetFromShipsSignal, &FleetWnd::CreateNewFleetFromDrops, this));

     SetText(TitleText());

@@ -1155,17 +1234,20 @@
     int num_open_windows = m_open_fleet_detail_wnds.size();
     GG::Pt window_posn(std::max(0, 25 + LowerRight().x + num_open_windows * 25), std::max(0, UpperLeft().y + num_open_windows * 25));
     if (!m_open_fleet_detail_wnds[row_fleet]) {
-        FleetDetailWnd* fleet_wnd = new FleetDetailWnd(window_posn.x, window_posn.y, row_fleet, m_read_only);
-        m_open_fleet_detail_wnds[row_fleet] = fleet_wnd;
-        if (GG::GUI::GetGUI()->AppWidth() < fleet_wnd->LowerRight().x)
-            window_posn.x = GG::GUI::GetGUI()->AppWidth() - fleet_wnd->Width();
-        if (GG::GUI::GetGUI()->AppHeight() < fleet_wnd->LowerRight().y)
-            window_posn.y = GG::GUI::GetGUI()->AppHeight() - fleet_wnd->Height();
-        fleet_wnd->MoveTo(window_posn);
-        m_open_fleet_detail_wnd_connections[fleet_wnd] =
-            GG::Connect(fleet_wnd->ClosingSignal, &FleetWnd::FleetDetailWndClosing, this);
-        GG::Connect(fleet_wnd->PanelEmptySignal, &FleetWnd::DeleteFleet, this);
-        GG::GUI::GetGUI()->Register(fleet_wnd);
+        FleetDetailWnd* fleet_detail_wnd = new FleetDetailWnd(window_posn.x, window_posn.y, row_fleet, m_read_only);
+        m_open_fleet_detail_wnds[row_fleet] = fleet_detail_wnd;
+        if (GG::GUI::GetGUI()->AppWidth() < fleet_detail_wnd->LowerRight().x)
+            window_posn.x = GG::GUI::GetGUI()->AppWidth() - fleet_detail_wnd->Width();
+        if (GG::GUI::GetGUI()->AppHeight() < fleet_detail_wnd->LowerRight().y)
+            window_posn.y = GG::GUI::GetGUI()->AppHeight() - fleet_detail_wnd->Height();
+        fleet_detail_wnd->MoveTo(window_posn);
+
+        m_open_fleet_detail_wnd_connections.insert(std::pair<FleetDetailWnd*, boost::signals::connection>(
+            fleet_detail_wnd, GG::Connect(fleet_detail_wnd->ClosingSignal, &FleetWnd::FleetDetailWndClosing, this)));
+        m_open_fleet_detail_wnd_connections.insert(std::pair<FleetDetailWnd*, boost::signals::connection>(
+            fleet_detail_wnd, GG::Connect(fleet_detail_wnd->PanelEmptySignal, &FleetWnd::DeleteFleet, this)));
+
+        GG::GUI::GetGUI()->Register(fleet_detail_wnd);
     }
}

@@ -1206,9 +1288,19 @@

     std::map<Fleet*, FleetDetailWnd*>::iterator it = m_open_fleet_detail_wnds.find(fleet);
     if (it != m_open_fleet_detail_wnds.end()) {
-        m_open_fleet_detail_wnd_connections[it->second].disconnect();
+
+        // disconnect all signals attached to this FleetDetailWnd
+        // find first signal...
+        std::multimap<FleetDetailWnd*, boost::signals::connection>::iterator sig_it = m_open_fleet_detail_wnd_connections.find(it->second);
+        while (sig_it != m_open_fleet_detail_wnd_connections.end()) {
+            // disconnect and remove from map
+            sig_it->second.disconnect();
+            m_open_fleet_detail_wnd_connections.erase(sig_it);
+            // find next signal, if present, until all signals disconnected and removed
+            sig_it = m_open_fleet_detail_wnd_connections.find(it->second);
+        }
+
         delete it->second;
-        m_open_fleet_detail_wnd_connections.erase(it->second);
         m_open_fleet_detail_wnds.erase(it);
     }
     NotShowingFleetSignal(fleet);
@@ -1223,6 +1315,10 @@

void FleetWnd::CreateNewFleetFromDrops(Ship* first_ship, const std::vector<int>& ship_ids)
{
+    Logger().errorStream() << "FleetWnd::CreateNewFleetFromDrops.  ship ids: ";
+    for (std::vector<int>::const_iterator it = ship_ids.begin(); it != ship_ids.end(); ++it)
+        Logger().errorStream() << ".. " << *it;
+
     Fleet* some_fleet = FleetInRow(0);

     // special case: disallow creating a new fleet from a ship when there is exactly 1 fleet containing exactly 1 ship
@@ -1250,10 +1346,11 @@

     Fleet* new_fleet = 0;
     if (system) {
+        Logger().errorStream() << "FleetWnd::CreateNewFleetFromDrops: Issuing NewFleetOrder at system with id: " << system->ID();
         HumanClientApp::GetApp()->Orders().IssueOrder(new NewFleetOrder(empire_id, fleet_name, new_fleet_id, system->ID(), ship_ids));
         System::ObjectVec fleets = system->FindObjectsInOrbit(-1, StationaryFleetVisitor(empire_id));
         for (unsigned int i = 0; i < fleets.size(); ++i) {
-            if (fleets[i]->Name() == fleet_name) {
+            if (fleets[i]->ID() == new_fleet_id) {
                 new_fleet = universe_object_cast<Fleet*>(fleets[i]);
                 break;
             }
@@ -1284,10 +1381,15 @@

     for (std::map<Fleet*, FleetDetailWnd*>::iterator it = m_open_fleet_detail_wnds.begin(); it != m_open_fleet_detail_wnds.end(); ++it) {
         if (it->first == fleet) {
-            m_open_fleet_detail_wnd_connections[it->second].disconnect();
-            delete it->second;
-            m_open_fleet_detail_wnd_connections.erase(it->second);
+            FleetDetailWnd* fleet_detail_wnd = it->second;
+            std::multimap<FleetDetailWnd*, boost::signals::connection>::iterator sig_it = m_open_fleet_detail_wnd_connections.find(fleet_detail_wnd);
+            while (sig_it != m_open_fleet_detail_wnd_connections.end()) {
+                sig_it->second.disconnect();
+                m_open_fleet_detail_wnd_connections.erase(sig_it);
+                sig_it = m_open_fleet_detail_wnd_connections.find(fleet_detail_wnd);
+            }
             m_open_fleet_detail_wnds.erase(it);
+            delete fleet_detail_wnd;
             break;
         }
     }


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 19, 2007 10:48 am 
Offline
Compilation Expert
User avatar

Joined: Thu Jul 06, 2006 10:30 pm
Posts: 219
Location: Russia/Moscow
Geoff the Medio wrote:
Did you update FleetWnd.cpp properly? Maybe refresh your browser, in case it's caching the old version?

Most likely it was wwwoffle's fault.

I had only one crash. I didn't save output because I thought I'll be able to reproduce it again but I couldn't. Good work!

BTW with revisions 2027 and 2030 I was unable to start a new game :
Code:
1174291877 ERROR  : ClientNetworkCore::ConnectToInternetServer : Call to NET2_TCPConnectTo() failed with server= "localhost"; SDL_net2 error: "NET2: can't open a socket"
1174291877 ERROR  : ClientNetworkCore::ConnectToInternetServer : Call to NET2_TCPConnectTo() failed with server= "localhost"; SDL_net2 error: "NET2: can't open a socket"
   etc...

I used revision 2022 for testing.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 19, 2007 2:37 pm 
Offline
Compilation Expert
User avatar

Joined: Thu Jul 06, 2006 10:30 pm
Posts: 219
Location: Russia/Moscow
I found another crash, which I reproduce as follows:

I open "Production" panel
I close "Production" panel
I open "Production" panel again
I try to build a colony ship
It crashes
There is no relevant debug messages.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 22, 2007 7:50 pm 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 7887
Location: Vancouver, BC
loonycyborg wrote:
I found another crash...

Try this patch for production screen signals-related crashes...
Code:
Index: ProductionWnd.cpp
===================================================================
--- ProductionWnd.cpp   (revision 2030)
+++ ProductionWnd.cpp   (working copy)
@@ -231,20 +231,27 @@

     EnableChildClipping(true);

-    GG::Connect(m_build_designator_wnd->AddBuildToQueueSignal, &ProductionWnd::AddBuildToQueueSlot, this);
-    GG::Connect(m_build_designator_wnd->BuildQuantityChangedSignal, &ProductionWnd::ChangeBuildQuantitySlot, this);
-    GG::Connect(m_build_designator_wnd->SystemSelectedSignal, SystemSelectedSignal);
-    GG::Connect(m_queue_lb->ErasedSignal, &ProductionWnd::QueueItemDeletedSlot, this);
-    GG::Connect(m_queue_lb->LeftClickedSignal, &ProductionWnd::QueueItemClickedSlot, this);
-    GG::Connect(m_queue_lb->DoubleClickedSignal, &ProductionWnd::QueueItemDoubleClickedSlot, this);
+    m_misc_connections.insert(GG::Connect(m_build_designator_wnd->AddBuildToQueueSignal, &ProductionWnd::AddBuildToQueueSlot, this));
+    m_misc_connections.insert(GG::Connect(m_build_designator_wnd->BuildQuantityChangedSignal, &ProductionWnd::ChangeBuildQuantitySlot, this));
+    m_misc_connections.insert(GG::Connect(m_build_designator_wnd->SystemSelectedSignal, SystemSelectedSignal));
+    m_misc_connections.insert(GG::Connect(m_queue_lb->ErasedSignal, &ProductionWnd::QueueItemDeletedSlot, this));
+    m_misc_connections.insert(GG::Connect(m_queue_lb->LeftClickedSignal, &ProductionWnd::QueueItemClickedSlot, this));
+    m_misc_connections.insert(GG::Connect(m_queue_lb->DoubleClickedSignal, &ProductionWnd::QueueItemDoubleClickedSlot, this));

     AttachChild(m_production_info_panel);
     AttachChild(m_queue_lb);
     AttachChild(m_build_designator_wnd);
}

+ProductionWnd::~ProductionWnd()
+{
+    // disconnect all signals
+    while (!m_misc_connections.empty()) {
+        m_misc_connections.begin()->disconnect();
+        m_misc_connections.erase(m_misc_connections.begin());
+    }
+}

-
bool ProductionWnd::InWindow(const GG::Pt& pt) const
{
     GG::Rect clip_rect = m_build_designator_wnd->MapViewHole() + m_build_designator_wnd->UpperLeft();

Index: BuildDesignatorWnd.h
===================================================================
--- BuildDesignatorWnd.h   (revision 2030)
+++ BuildDesignatorWnd.h   (working copy)
@@ -25,6 +25,7 @@

     /** \name Structors */ //@{
     BuildDesignatorWnd(int w, int h);
+    ~BuildDesignatorWnd();
     //@}

     /** \name Accessors */ //@{
@@ -61,6 +62,8 @@
     int                m_build_location;
     GG::Rect           m_map_view_hole;
     std::map<int, int> m_system_default_planets;
+
+    std::set<boost::signals::connection> m_misc_connections;
};

#endif // _BuildDesignatorWnd_h_

Index: ProductionWnd.h
===================================================================
--- ProductionWnd.h   (revision 2030)
+++ ProductionWnd.h   (working copy)
@@ -17,6 +17,7 @@
public:
     /** \name Structors */ //@{
     ProductionWnd(int w, int h);
+    ~ProductionWnd();
     //@}

     /** \name Signal Types */ //@{
@@ -51,6 +52,8 @@
     ProductionInfoPanel* m_production_info_panel;
     CUIListBox*          m_queue_lb;
     BuildDesignatorWnd*  m_build_designator_wnd;
+
+    std::set<boost::signals::connection> m_misc_connections;
};

#endif // _ProductionWnd_h_
Index: BuildDesignatorWnd.cpp
===================================================================
--- BuildDesignatorWnd.cpp   (revision 2030)
+++ BuildDesignatorWnd.cpp   (working copy)
@@ -41,6 +41,7 @@
{
public:
     BuildDetailPanel(int w, int h);
+    ~BuildDetailPanel();
     int QueueIndexShown() const;
     virtual void Render();
     void SelectedBuildLocation(int location);
@@ -76,7 +77,7 @@
     CUIMultiEdit*       m_description_box;
     GG::StaticGraphic*  m_item_graphic;

-    boost::signals::connection m_num_items_to_build_connect;
+    std::set<boost::signals::connection> m_misc_connections;
};

BuildDesignatorWnd::BuildDetailPanel::BuildDetailPanel(int w, int h) :
@@ -108,9 +109,9 @@

     m_item_graphic = 0;

-    GG::Connect(m_recenter_button->ClickedSignal, &BuildDesignatorWnd::BuildDetailPanel::CenterClickedSlot, this);
-    GG::Connect(m_add_to_queue_button->ClickedSignal, &BuildDesignatorWnd::BuildDetailPanel::AddToQueueClickedSlot, this);
-    m_num_items_to_build_connect = GG::Connect(m_num_items_to_build->ValueChangedSignal, &BuildDesignatorWnd::BuildDetailPanel::ItemsToBuildChangedSlot, this);
+    m_misc_connections.insert(GG::Connect(m_recenter_button->ClickedSignal, &BuildDesignatorWnd::BuildDetailPanel::CenterClickedSlot, this));
+    m_misc_connections.insert(GG::Connect(m_add_to_queue_button->ClickedSignal, &BuildDesignatorWnd::BuildDetailPanel::AddToQueueClickedSlot, this));
+    m_misc_connections.insert(GG::Connect(m_num_items_to_build->ValueChangedSignal, &BuildDesignatorWnd::BuildDetailPanel::ItemsToBuildChangedSlot, this));

     AttachChild(m_item_name_text);
     AttachChild(m_cost_text);
@@ -122,6 +123,15 @@
     AttachChild(m_description_box);
}

+BuildDesignatorWnd::BuildDetailPanel::~BuildDetailPanel()
+{
+    // disconnect all signals
+    while (!m_misc_connections.empty()) {
+        m_misc_connections.begin()->disconnect();
+        m_misc_connections.erase(m_misc_connections.begin());
+    }
+}
+
int BuildDesignatorWnd::BuildDetailPanel::QueueIndexShown() const
{
     return m_queue_idx;
@@ -190,14 +200,11 @@
     m_num_items_to_build_label->Show();
     m_build_location_name_text->Show();
     m_recenter_button->Disable(!DisplayingQueueItem());
-    m_num_items_to_build_connect.disconnect();
     m_num_items_to_build->SetValue(1);

     Empire* empire = Empires().Lookup(HumanClientApp::GetApp()->EmpireID());
-    if (!empire) {
-        m_num_items_to_build_connect = GG::Connect(m_num_items_to_build->ValueChangedSignal, &BuildDesignatorWnd::BuildDetailPanel::ItemsToBuildChangedSlot, this);
+    if (!empire)
         return;
-    }

     const ProductionQueue& queue = empire->GetProductionQueue();
     if (static_cast<int>(queue.size()) <= m_queue_idx) {
@@ -220,8 +227,6 @@
         ConfigureForNewBuildView();
     }

-    m_num_items_to_build_connect = GG::Connect(m_num_items_to_build->ValueChangedSignal, &BuildDesignatorWnd::BuildDetailPanel::ItemsToBuildChangedSlot, this);
-
     CheckBuildability();

     using boost::io::str;
@@ -358,6 +363,7 @@
{
public:
     BuildSelector(int w, int h);
+    ~BuildSelector();

     virtual void MinimizeClicked();

@@ -385,6 +391,8 @@
     std::map<GG::ListBox::Row*, BuildType> m_build_types;
     GG::Pt                                 m_original_ul;

+    std::set<boost::signals::connection>   m_misc_connections;
+
     friend struct PopulateListFunctor;
};

@@ -408,18 +416,18 @@
     for (BuildType i = BuildType(BT_NOT_BUILDING + 1); i < NUM_BUILD_TYPES; i = BuildType(i + 1)) {
         CUIButton* button = new CUIButton(0, 0, 1, UserString("PRODUCTION_WND_CATEGORY_" + boost::lexical_cast<std::string>(i)));
         button_height = button->Height();
-        GG::Connect(button->ClickedSignal, CategoryClickedFunctor(i, *this));
+        m_misc_connections.insert(GG::Connect(button->ClickedSignal, CategoryClickedFunctor(i, *this)));
         m_build_category_buttons.push_back(button);
         layout->Add(button, 0, i - (BT_NOT_BUILDING + 1));
     }
     CUIButton* button = new CUIButton(0, 0, 1, UserString("ALL"));
     button_height = button->Height();
-    GG::Connect(button->ClickedSignal, CategoryClickedFunctor(NUM_BUILD_TYPES, *this));
+    m_misc_connections.insert(GG::Connect(button->ClickedSignal, CategoryClickedFunctor(NUM_BUILD_TYPES, *this)));
     m_build_category_buttons.push_back(button);
     layout->Add(button, 0, NUM_BUILD_TYPES - (BT_NOT_BUILDING + 1));
     m_buildable_items = new BuildableItemsListBox(0, 0, 1, 1);
-    GG::Connect(m_buildable_items->SelChangedSignal, &BuildDesignatorWnd::BuildSelector::BuildItemSelected, this);
-    GG::Connect(m_buildable_items->DoubleClickedSignal, &BuildDesignatorWnd::BuildSelector::BuildItemDoubleClicked, this);
+    m_misc_connections.insert(GG::Connect(m_buildable_items->SelChangedSignal, &BuildDesignatorWnd::BuildSelector::BuildItemSelected, this));
+    m_misc_connections.insert(GG::Connect(m_buildable_items->DoubleClickedSignal, &BuildDesignatorWnd::BuildSelector::BuildItemDoubleClicked, this));
     m_buildable_items->SetStyle(GG::LB_NOSORT | GG::LB_SINGLESEL);
     layout->Add(m_buildable_items, 1, 0, 1, layout->Columns());
     layout->SetMinimumRowHeight(0, button_height);
@@ -429,6 +437,15 @@
     PopulateList(m_current_build_type, false);
}

+BuildDesignatorWnd::BuildSelector::~BuildSelector()
+{
+    // disconnect all signals
+    while (!m_misc_connections.empty()) {
+        m_misc_connections.begin()->disconnect();
+        m_misc_connections.erase(m_misc_connections.begin());
+    }
+}
+
void BuildDesignatorWnd::BuildSelector::MinimizeClicked()
{
     if (!m_minimized) {
@@ -639,12 +656,12 @@
     m_side_panel = new SidePanel(Width() - MapWnd::SIDE_PANEL_WIDTH, 0, MapWnd::SIDE_PANEL_WIDTH, GG::GUI::GetGUI()->AppHeight());
     m_side_panel->Hide();

-    GG::Connect(m_build_detail_panel->RequestBuildItemSignal, &BuildDesignatorWnd::BuildItemRequested, this);
-    GG::Connect(m_build_detail_panel->BuildQuantityChangedSignal, BuildQuantityChangedSignal);
-    GG::Connect(m_build_selector->DisplayBuildItemSignal, &BuildDesignatorWnd::BuildDetailPanel::SetBuildItem, m_build_detail_panel);
-    GG::Connect(m_build_selector->RequestBuildItemSignal, &BuildDesignatorWnd::BuildItemRequested, this);
-    GG::Connect(m_side_panel->PlanetSelectedSignal, &BuildDesignatorWnd::SelectPlanet, this);
-    GG::Connect(m_side_panel->SystemSelectedSignal, SystemSelectedSignal);
+    m_misc_connections.insert(GG::Connect(m_build_detail_panel->RequestBuildItemSignal, &BuildDesignatorWnd::BuildItemRequested, this));
+    m_misc_connections.insert(GG::Connect(m_build_detail_panel->BuildQuantityChangedSignal, BuildQuantityChangedSignal));
+    m_misc_connections.insert(GG::Connect(m_build_selector->DisplayBuildItemSignal, &BuildDesignatorWnd::BuildDetailPanel::SetBuildItem, m_build_detail_panel));
+    m_misc_connections.insert(GG::Connect(m_build_selector->RequestBuildItemSignal, &BuildDesignatorWnd::BuildItemRequested, this));
+    m_misc_connections.insert(GG::Connect(m_side_panel->PlanetSelectedSignal, &BuildDesignatorWnd::SelectPlanet, this));
+    m_misc_connections.insert(GG::Connect(m_side_panel->SystemSelectedSignal, SystemSelectedSignal));

     m_map_view_hole = GG::Rect(0, 0, CHILD_WIDTHS + SidePanel::MAX_PLANET_DIAMETER, h);

@@ -653,6 +670,15 @@
     AttachChild(m_side_panel);
}

+BuildDesignatorWnd::~BuildDesignatorWnd()
+{
+    // disconnect all signals
+    while (!m_misc_connections.empty()) {
+        m_misc_connections.begin()->disconnect();
+        m_misc_connections.erase(m_misc_connections.begin());
+    }
+}
+
bool BuildDesignatorWnd::InWindow(const GG::Pt& pt) const
{
     GG::Rect clip_rect = m_map_view_hole + UpperLeft();


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 22, 2007 9:21 pm 
Offline
Compilation Expert
User avatar

Joined: Thu Jul 06, 2006 10:30 pm
Posts: 219
Location: Russia/Moscow
The crash still occurs, its reproduction method is the same.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 52 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group