wxObject Line 346 causing app crash

If you are using wxDev-C++ for your wxWidgets design, please ask your questions here instead of in IDE Related.
Post Reply
birendra
In need of some credit
In need of some credit
Posts: 4
Joined: Wed Oct 31, 2012 5:16 am

wxObject Line 346 causing app crash

Post by birendra »

Hi to all

My multithreded application crash due to an assert error in wxobject.cpp. I searched about it and found reasons could be the
use of wxBrush , a secondary thread accessing GUI element . I am not using wxBrush anywhere and from secondary thread I am posting event to
update GUI . can anybody tell me what could be other reason for this crash . my windb analysis is as follows :-

FAULTING_IP:
ntdll!DbgBreakPoint+0
77d7884e cc int 3

EXCEPTION_RECORD: ffffffff -- (.exr 0xffffffffffffffff)
ExceptionAddress: 77d7884e (ntdll!DbgBreakPoint)
ExceptionCode: 80000003 (Break instruction exception)
ExceptionFlags: 00000000
NumberParameters: 3
Parameter[0]: 00000000
Parameter[1]: 84a7b2d0
Parameter[2]: 025fc94c

FAULTING_THREAD: 00000668

DEFAULT_BUCKET_ID: WRONG_SYMBOLS

PROCESS_NAME: Test.exe

ADDITIONAL_DEBUG_TEXT:
You can run '.symfix; .reload' to try to fix the symbol path and load symbols.

MODULE_NAME: Test

FAULTING_MODULE: 77d30000 ntdll

DEBUG_FLR_IMAGE_TIMESTAMP: 508e6c8b

ERROR_CODE: (NTSTATUS) 0x80000003 - {EXCEPTION} Breakpoint A breakpoint has been reached.

EXCEPTION_CODE: (HRESULT) 0x80000003 (2147483651) - One or more arguments are invalid

EXCEPTION_PARAMETER1: 00000000

EXCEPTION_PARAMETER2: 84a7b2d0

EXCEPTION_PARAMETER3: 025fc94c

APP: test.exe

PRIMARY_PROBLEM_CLASS: WRONG_SYMBOLS

BUGCHECK_STR: APPLICATION_FAULT_WRONG_SYMBOLS

LAST_CONTROL_TRANSFER: from 0056968d to 77d7884e

STACK_TEXT:
WARNING: Stack unwind information not available. Following frames may be wrong.
025fc938 0056968d 12e4bcb7 00000000 025fc958 ntdll!DbgBreakPoint
025fc960 00557ed2 006a5484 0000015a 006a5474 Test!wxOnAssert+0x4d
025fc990 00557e5f 025fcb6c 025fc9b8 00401d21 Test!wxObject::UnRef+0x42
025fc99c 00401d21 025fca4c 01c72230 00476223 Test!wxObject::Ref+0x1f
025fc9a8 00476223 025fca4c 025fcb6c 025fc9c8 Test!wxObject::operator=+0x11
025fc9b8 004bc723 025fca4c 025fcb6c 025fc9d8 Test!wxGDIObject::operator=+0x13
025fc9c8 004bc703 025fca4c 025fcb6c 025fca14 Test!wxBrushBase::operator=+0x13
025fc9d8 004c894a 025fca4c 12e4bfc3 025fca38 Test!wxBrush::operator=+0x13
025fca14 004cc387 025fca4c 12e4bfb7 025fca4c Test!wxDC::SetBackground+0x3a
025fca60 004cc51f 025fcad8 025fca88 004cc4eb Test!wxWindowDC::InitDC+0x87
025fca6c 004cc4eb 12e4bf5f 025fcad8 025fcbd8 Test!wxClientDC::InitDC+0xf
025fca88 004967f0 01c72230 12e4be33 00000050 Test!wxClientDC::wxClientDC+0x9b
025fcbe4 0047ae8e 025fcbfc 01c72230 00c0b790 Test!wxStaticText::DoGetBestSize+0x40
025fcc1c 00496a53 000000c8 00000190 ffffffff Test!wxWindow::DoSetSize+0xce
025fcc3c 00496ab2 ffffffff ffffffff ffffffff Test!wxStaticText::DoSetSize+0x23
025fcc5c 004251e9 025fccb8 12e4b9bb 025ffafc Test!wxStaticText::SetLabel+0x42
025fcec4 0045bb69 00000012 00000001 33333333 Test!MyEWrapper::tickPrice+0x5d9
025fcf04 00450fec 00000012 00000001 33333333 Test!EWrapperL0Impl::tickPrice+0x79
025ffb0c 004508b3 025ffb44 01c8c4dc 12e48eb3 Test!EClientSocketBase::processMsg+0x21c
025ffb64 0045b7ca 12e48b33 00000000 025ffef0 Test!EClientSocketBase::checkMessages+0xc3
025ffee4 0045b442 00000001 12e48acf 00000000 Test!EClientL0Impl::checkMessagesOnce+0x30a
025fff18 0045a198 12e48a97 00000000 00000000 Test!EClientL0Impl::checkMessagesLoop+0xa2
025fff40 005cc763 01c4b3e8 12e48aab 00000000 Test!ThreadMain+0x38
025fff7c 005cc6f9 00000000 025fff94 770cd309 Test!_callthreadstart+0x53
025fff88 770cd309 01c4d960 025fffd4 77d716c3 Test!_threadstart+0x99
025fff94 77d716c3 01c4d960 75ad23aa 00000000 kernel32!BaseThreadInitThunk+0x12
025fffd4 77d71696 005cc660 01c4d960 ffffffff ntdll!RtlInitializeExceptionChain+0x63
025fffec 00000000 005cc660 01c4d960 00000000 ntdll!RtlInitializeExceptionChain+0x36


FOLLOWUP_IP:
Test!wxObject::UnRef+42 [c:\buildagent\work\wxpack\wxwidgets\src\common\object.cpp @ 346]
00557ed2 83c414 add esp,14h

FAULTING_SOURCE_LINE: c:\buildagent\work\wxpack\wxwidgets\src\common\object.cpp

FAULTING_SOURCE_FILE: c:\buildagent\work\wxpack\wxwidgets\src\common\object.cpp

FAULTING_SOURCE_LINE_NUMBER: 346

FAULTING_SOURCE_CODE:
No source found for 'c:\buildagent\work\wxpack\wxwidgets\src\common\object.cpp'


SYMBOL_STACK_INDEX: 2

SYMBOL_NAME: test!wxObject::UnRef+42

FOLLOWUP_NAME: MachineOwner

IMAGE_NAME: Test.exe

STACK_COMMAND: ~4s ; kb

BUCKET_ID: WRONG_SYMBOLS

FAILURE_BUCKET_ID: WRONG_SYMBOLS_80000003_Test.exe!wxObject::UnRef

Followup: MachineOwner
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxObject Line 346 causing app crash

Post by doublemax »

Hard to tell. When does your application crash, at the start or do you have to do something special to trigger the crash?

Did your application work correctly at some point in time?

Can you reduce it to a minimal sample that shows the problem?

Is any of the methods listed in the callstack related to a secondary thread?

How did you initialize wxWidgets? Do you have an wxApp object or did you do it manually?
Use the source, Luke!
birendra
In need of some credit
In need of some credit
Posts: 4
Joined: Wed Oct 31, 2012 5:16 am

Re: wxObject Line 346 causing app crash

Post by birendra »

Hello @doublemax sorry for my late response

I am giving my design structure as follows :-

class ibgServer: public wxFrame,public someAPIClass
{
private:
ibgServer()
{
}

ibgServer(const wxString& title, const wxPoint& pos, const wxSize& size,long style , const wxString& name );

void APIVirtualFunc( double value )
{
/// on some condition I am setting label of StaticText1 and updating its background color.

if(value>0)
StaticText1 ->SetBackgroundColour(wxColour(138,255,138));
else
StaticText1->SetBackgroundColour(wxColour(255,168,125));
StaticText1->SetLabel(wxString::Format(wxT("%5.4f"),value));


}

public:

static wxStaticText* StaticText1;
// some other contorl here like wxpanel etc.

};

// static variables of ibgServer.
wxStaticText * ibgServer::StaticText1;
//other declration like panel etc.

ibgServer::ibgServer(const wxString& title, const wxPoint& pos, const wxSize& size,long style , const wxString& name )
: wxFrame(NULL, -1, title, pos, size,style,name)
{

panel= new wxPanel(this,wxID_ANY );
StaticText1 = new wxStaticText(panel, -1, _("Test "), wxPoint(130,5), wxSize(200,40), 0, _T("ID_STATICTEXT2"));
font1 = wxFont(18,wxFONTFAMILY_DEFAULT,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,0,_(" "),wxFONTENCODING_DEFAULT);
StaticText1->SetFont(font1);
StatusBar1 = new wxStatusBar(this, -1, 0, _T("ID_STATUSBAR1"));
int __wxStatusBarWidths_1[1] = { -1 };
int __wxStatusBarStyles_1[1] = { wxSB_NORMAL };
StatusBar1->SetFieldsCount(1,__wxStatusBarWidths_1);
StatusBar1->SetStatusStyles(1,__wxStatusBarStyles_1);
SetStatusBar(StatusBar1);
}

ibgServer *frame1;

class MyApp : public wxApp
{

public:
bool OnInit()
{

frame1 = new ibgServer( _("Test"), wxPoint(50, 50), wxSize(870, 400) );
frame1->Show(true);
return true;
}
};
IMPLEMENT_APP(MyApp)

I hope this would give you a clear picture thanks
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxObject Line 346 causing app crash

Post by doublemax »

Please answer the questions 1,2 and 4 from my last post.

Code: Select all

025ffb0c 004508b3 025ffb44 01c8c4dc 12e48eb3 Test!EClientSocketBase::processMsg+0x21c
025ffb64 0045b7ca 12e48b33 00000000 025ffef0 Test!EClientSocketBase::checkMessages+0xc3
025ffee4 0045b442 00000001 12e48acf 00000000 Test!EClientL0Impl::checkMessagesOnce+0x30a
025fff18 0045a198 12e48a97 00000000 00000000 Test!EClientL0Impl::checkMessagesLoop+0xa2
What are these methods doing? Do you have your own event loop?

How do you send the message from the secondary thread to the main thread? (Which method do you call?)
Use the source, Luke!
birendra
In need of some credit
In need of some credit
Posts: 4
Joined: Wed Oct 31, 2012 5:16 am

Re: wxObject Line 346 causing app crash

Post by birendra »

Hi again doublemax

Ans for 1 ,2 : this crash beaviour is random . sometime my application runs for a week and more without any crash and sometime it crashes twice a day .
ans for 4 : the api class I am inheriting have the function checkMessages() which gives me data through its virtual function which i have implemented in my class
i.e. APIVirtualFunc( double value ) named in my previous post . in this function i am directly displaying data in statictext control .

thanks
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxObject Line 346 causing app crash

Post by doublemax »

i.e. APIVirtualFunc( double value ) named in my previous post . in this function i am directly displaying data in statictext control .
It's unclear from where this is called. You must not call this from a worker thread.
How do you send the message from the secondary thread to the main thread? (Which method do you call?)
Use the source, Luke!
birendra
In need of some credit
In need of some credit
Posts: 4
Joined: Wed Oct 31, 2012 5:16 am

Re: wxObject Line 346 causing app crash

Post by birendra »

that is implemented by my API library , I mean I never call APIVirtualFunc(int value ). this is a receiver function provided by API class to whom I have inherited .
when I make a call to checkMessages() then I receive values in the APIVirtualFunc(). I have not added line i.e. frame1->checkMessages(); since it is inside a button event which I had not shown in my
last to last post to remove the code length.
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxObject Line 346 causing app crash

Post by doublemax »

If APIVirtualFunc() is called from a seondary thread, it could explain the error. Without seeing the "bigger picture" i can't say more.
Use the source, Luke!
Post Reply