[Interest] Application crash with QLocale

Stefan Walter Stefan.Walter at lisec.com
Tue Jun 12 20:36:03 CEST 2012


QApplication needs to be instantiated before you do any other call to Qt functionalities.

Therefore i assume to put it in a subclass of the QMainWindow is the wrong place.

Try to move it into your main() function.

Stefan

On 12.06.2012, at 22:20, "Scott Aron Bloom" <Scott.Bloom at onshorecs.com> wrote:

> Put up sample code to duplicate the issue…
>  
> From: norulez at me.com [mailto:norulez at me.com] 
> Sent: Tuesday, June 12, 2012 11:11 AM
> To: Scott Aron Bloom
> Subject: Re: [Interest] Application crash with QLocale
>  
> Yes, the class is called from a function in a QMainWindow subclass.
>  
> The Problem also occurs in a unit test.
> 
> 
> Am 12.06.2012 um 19:26 schrieb Scott Aron Bloom <Scott.Bloom at onshorecs.com>:
> 
> Has your QApplication been instantiated yet?
>  
> Scott
>  
> From: interest-bounces+scott.bloom=onshorecs.com at qt-project.org [mailto:interest-bounces+scott.bloom=onshorecs.com at qt-project.org] On Behalf Of NoRulez
> Sent: Tuesday, June 12, 2012 10:25 AM
> To: Qt Project MailingList
> Subject: Re: [Interest] Application crash with QLocale
>  
> It seems to work when m_locale is a global variable:
> namespace {
>     QLocale m_locale;
> }
> 
> But I don't know why. Does anyone has an idea what the problem could be?
> 
> Thanks in advance
> 
> Am 12. Jun 2012 um 19:12 schrieb NoRulez <norulez at me.com>:
> 
> Hi,
> 
> in the debug version I get the following message when creating a QLocale::system(): 
> ASSERT: "index <= locale_data_size" in file tools/qlocale.cpp, line 601
> 
> In the release version the application crashes with a runtime error.
> 
> The only thing I do was to set a member variable:
> QLocale m_locale;
> 
> 
> Here is the implementation:
> MyClass::MyClass() : m_locale(QLocale::system()) {}
> void MyClass::setLocale(const QLocale &locale) { m_locale = locale; }
> const MyClass::QLocale& locale() const { return m_locale; }
> 
> Any hints?
> 
> Best Regards
> NoRulez
> 
> 
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
> <Part.002>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120612/f79507f8/attachment.html>


More information about the Interest mailing list