Opened 17 years ago

Last modified 15 years ago

#994 closed defect

wxMac: panel crash when 2. call to wxEntry

Reported by: anonymous Owned by:
Priority: normal Milestone:
Component: old wxOSX/Carbon port Version:
Keywords: Cc: csomor, hockkn
Blocked By: Blocking:
Patch: no


Hi! I wasnt able to find it out myself. Using OSX with Carbon shared


MyFrame *frame = new MyFrame( NULL, -1, wxT("SuperApp"),
wxPoint(20,20), wxSize(500,340) );

wxPanel *item3 = new wxPanel( frame, -1 );
frame->Show( TRUE );

(own main):
wxEntry(0,nil,true); <- crashes

doesnt crash without panel. doesnt crash with buttons, checkboxes
and radiobuttons.

OSX crashlog:

Date/Time: 2003-05-19 20:28:00 +0200
OS Version: 10.2.5 (Build 6L29)
Host: Powerbook500.local.

Command: Universe Animator 5.0.2
PID: 1472

Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_INVALID_ADDRESS (0x0001) at 0x047f7868

Thread 0 Crashed:

#0 0x022f109c in Block_link
#1 0x022f19e4 in deallocate_from_var_pools
#2 0x022f1f8c in deallocate_from_fixed_pools
#3 0x022f2154 in _pool_free
#4 0x022f24dc in free
#5 0x022f076c in dl(void *)
#6 0x02faecc8 in wxWindowListNode::_dt(void)
#7 0x02f9a6fc in wxListBase::DoDeleteNode(wxNodeBase *)
#8 0x02f9a92c in wxListBase::DeleteNode(wxNodeBase *)
#9 0x02f9a9cc in wxListBase::DeleteObject(void *)
#10 0x02fac10c in wxWindowBase::RemoveChild(wxWindowBase *)
#11 0x02f471f0 in wxWindow::RemoveChild(wxWindowBase *)
#12 0x02f439ec in wxWindow::_dt(void)
#13 0x02ff6d60 in wxControlBase::_dt(void)
#14 0x02efe798 in wxControl::_dt(void)
#15 0x02f2cbe0 in wxScrollBar::_dt(void)
#16 0x02fab340 in wxWindowBase::DestroyChildren(void)
#17 0x02f439f8 in wxWindow::_dt(void)
#18 0x03053340 in wxPanel::_dt(void)
#19 0x02fab340 in wxWindowBase::DestroyChildren(void)
#20 0x02f439f8 in wxWindow::_dt(void)
#21 0x031183e4 in wxTopLevelWindowBase::_dt(void)
#22 0x03119484 in wxTopLevelWindowMac::_dt(void)
#23 0x02ff01d0 in wxFrameBase::_dt(void)
#24 0x02f15a2c in wxFrame::_dt(void)
#25 0x022d0cb0 in MyFrame::_dt(void)
#26 0x02ee7ab4 in wxApp::DeletePendingObjects(void)
#27 0x02ee82f0 in wxApp::MacDoOneEvent(void)
#28 0x02ee73b8 in wxApp::MainLoop(void)
#29 0x02f592ac in wxAppBase::OnRun(void)
#30 0x02ee6dfc in wxEntry(int, char , bool)
#31 0x022b63bc in 0x22b63bc
#32 0x022a6918 in Main
#33 0x00b14b24 in EI_CallPluginRoutine
#34 0x0057c1f0 in CommandInterfacePlugin(Plugin *)
#35 0x004b35bc in OptionGroupPlugin(GeoGroup *)
#36 0x004b8d9c in 0x4b8d9c
#37 0x009f03b4 in FWView::SendInterfaceEvent(FWView *)
#38 0x00a16414 in PushButton::MouseDownEvent(FWEvent &)
#39 0x0097bc10 in FWEventDispatcher::MouseDownEvent(FWEvent


#40 0x0097cb7c in FWEventDispatcher::Dispatch(FWEvent &)
#41 0x007395b0 in 0x7395b0
#42 0x00a27e7c in FWEventManager::Execute(void)
#43 0x00971ae4 in FWApp::Execute(FWApp *)
#44 0x0072b470 in EIMain(void)
#45 0x0072b524 in main

Sincerely, Patrick

Change History (8)

comment:1 Changed 17 years ago by anonymous

Logged In: NO

Its Patrick again. the code works with the static .lib which works fine for me,
too. seems to be a problem with the sharedlib. so no hurry. nice work, guys!!

  • Patrick

comment:2 Changed 17 years ago by csomor


so you are loading and unloading the entire environment,
using wxEntry, wxApp::CleanUp ? what do you do with the c-
runtime environment ? could it be that the frame that gets
deleted in this stack trace is the one that was allocated
during the first run ?

comment:3 Changed 17 years ago by anonymous

Logged In: NO

Hello, csomor,

I am linking against the shared lib, so it should init itself. for the c-code in
my prog I do

extern MyApp& wxGetApp();
extern wxApp *wxCreateApp();

wxAppInitializer wxTheAppInitializer((wxAppInitializerFunction)




to init and exec my code manually after declaring the app (which is in
another file).

Am I missing something when I link against the shared lib then (difference
between shared/static lib)?
The code works when I link against the static lib (using initialize and
terminate as DLL-settings).

Hmm, all objects are deleted when the window is closed the first time, I
traced that. and after freeing the mem its filled with AFs.
It crashed when the second scrollbar unregisters (m_parent-

RemoveChild(this)) itself from its parent (the panel).

Maybe I did something wrong when I compiled the shared lib. no idea.
I will test it with minimal.prj linked against shared lib and see. hang on.


comment:4 Changed 17 years ago by anonymous

Logged In: NO

minimal.prj with my sourcecode and the shared libs works.

comment:5 Changed 17 years ago by anonymous

Logged In: NO

the minimal.prj with my source and shared lib works.
so I guess its my wrong somewhere and it works for me with the static lib.


comment:6 Changed 17 years ago by csomor

Hi Patrick
why are you calling wxEntry twice ? you should call it once
then you should drive the event loop and in the end call
otherwise a lot of structures may not be in a correct state
Best, Stefan

comment:7 Changed 17 years ago by anonymous

Logged In: NO

Hello Stefan,
double calling wxEntry is because I need to pop up the dialog more than
once. I looked through the code and saw that wEntry is already doing a lot of
cleaning up in the end. I didnt find docs on how to use wx with my own
main, it just stated, I have to use it by "calling wxEntry".
Hmm, calling either one of the suggested calls crashes with shared lib and
with static lib.
Regards, Patrick

comment:8 Changed 15 years ago by hockkn

If you need to pop up a dialog more than once, create a
separate class for that dialog and create two of those dialog
objects. See any of the samples for this type of subclassing.
There is no reason to try and abuse wxEntry by calling it
twice simply to show two dialogs.

Note: See TracTickets for help on using tickets.