Sometimes, a modal popup dialog (QDialog subclass) will disappear or hide 'on its own'; it will continue to block all events to the main page but will be invisible, thus forcing a program restart. This will happen on some runs of the program but not others, with what appear to be identical inputs. Using the debugger, I can see that the program is indeed stopped on the exec() function call. However since the dialog is invisible there is no way to interact with it. The dialog is created with
QDialog( parent, Qt::Dialog | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint )
and
setModal(true);
How can I figure out what's going on here?
Edit 1: A little more code although I don't think it adds much:
ModalDialog dialog( this, "Display text" );
dialog.Run(); //Just calls exec()
It's really as simple as this. However, the call stack might be more revealing; Hooli.exe!ModalDialog::Run(bool async) occurs twice--how could that happen?
ntdll.dll!773901fd() Unknown [Frames below may be incorrect and/or
missing, no symbols loaded for ntdll.dll]
ntdll.dll!773901fd() Unknown KernelBase.dll!758e170b() Unknown
KernelBase.dll!758e1641() Unknown user32.dll!74ec77d3() Unknown
user32.dll!74ed087a() Unknown Qt5Cored.dll!6659d658() Unknown
Qt5Widgetsd.dll!64249590() Unknown
Qt5Widgetsd.dll!6429fe0f() Unknown Qt5Cored.dll!662b5eed() Unknown
msvcr110d.dll!_unlock(int locknum) Line 366 C
msvcr110d.dll!_free_dbg(void * pUserData, int nBlockUse) Line
1270 C++ msvcr110d.dll!_free_dbg(void * pUserData, int nBlockUse)
Line 1267 C++ Qt5Cored.dll!66272413() Unknown
Qt5Widgetsd.dll!64384d57() Unknown
Qt5Widgetsd.dll!64249590() Unknown
Qt5Widgetsd.dll!6429fe0f() Unknown msvcr110d.dll!_unlock(int
locknum) Line 366 C msvcr110d.dll!operator delete(void * pUserData)
Line 57 C++ msvcr110d.dll!operator delete(void * pUserData) Line
56 C++ Qt5Cored.dll!6668b5b5() Unknown
Qt5Cored.dll!662b5eed() Unknown Qt5Widgetsd.dll!64384d57() Unknown
Qt5Widgetsd.dll!64253b6d() Unknown
Qt5Widgetsd.dll!64251cd5() Unknown verifier.dll!10acab48() Unknown
verifier.dll!10ac9807() Unknown verifier.dll!10ac9813() Unknown
Qt5Cored.dll!662b5eed() Unknown Qt5Widgetsd.dll!64253b6d() Unknown
Qt5Widgetsd.dll!64251cd5() Unknown
Qt5Widgetsd.dll!64249590() Unknown
Qt5Widgetsd.dll!6429fe0f() Unknown
Qt5Widgetsd.dll!64249590() Unknown
Qt5Widgetsd.dll!6429fe0f() Unknown
Qt5Widgetsd.dll!64262543() Unknown
Qt5Widgetsd.dll!6429f909() Unknown
Qt5Widgetsd.dll!6423f6e4() Unknown
Qt5Widgetsd.dll!6470af14() Unknown Qt5Cored.dll!6651591b() Unknown
verifier.dll!10ac98bc() Unknown KernelBase.dll!758e5500() Unknown
KernelBase.dll!758e55f3() Unknown imm32.dll!755f1db3() Unknown
imm32.dll!755f1ed8() Unknown msctf.dll!75346306() Unknown
msctf.dll!753462ec() Unknown msctf.dll!7534467c() Unknown
msctf.dll!753441b5() Unknown msctf.dll!753441b5() Unknown
user32.dll!74ec62fa() Unknown msctf.dll!753441b5() Unknown
msctf.dll!753441b5() Unknown user32.dll!74ec6d91() Unknown
user32.dll!74ec6ce9() Unknown user32.dll!74ec6d91() Unknown
Qt5Widgetsd.dll!64284b8f() Unknown msctf.dll!753441b5() Unknown
msctf.dll!753441b5() Unknown user32.dll!74ecd69b() Unknown
user32.dll!74ecd762() Unknown user32.dll!74ecd71e() Unknown
user32.dll!74ec62fa() Unknown user32.dll!74ec6d91() Unknown
user32.dll!74ec6ce9() Unknown user32.dll!74ec6d91() Unknown
user32.dll!74ec966e() Unknown user32.dll!74ecd70c() Unknown
verifier.dll!10ac98bc() Unknown user32.dll!74ec6210() Unknown
user32.dll!74ec6b34() Unknown qwindowsd.dll!1971dad1() Unknown
msctf.dll!753441b5() Unknown user32.dll!74ec62fa() Unknown
user32.dll!74ec6d91() Unknown user32.dll!74ec6ce9() Unknown
user32.dll!74ec6d91() Unknown user32.dll!74ec6ce9() Unknown
user32.dll!74ec966e() Unknown user32.dll!74ec96d5() Unknown
user32.dll!74ecda5b() Unknown user32.dll!74ec978a() Unknown
user32.dll!74ecda73() Unknown user32.dll!74ecd9bc() Unknown
user32.dll!74ecadb3() Unknown user32.dll!74ec62fa() Unknown
user32.dll!74ec6d91() Unknown user32.dll!74ec6ce9() Unknown
user32.dll!74ec6d91() Unknown user32.dll!74ec966e() Unknown
user32.dll!74ecd70c() Unknown user32.dll!74ec6210() Unknown
user32.dll!74ec6b34() Unknown user32.dll!74ec6b00() Unknown
user32.dll!74ec6b00() Unknown qwindowsd.dll!1971dad1() Unknown
user32.dll!74ec6ce9() Unknown user32.dll!74ec6d91() Unknown
user32.dll!74ec966e() Unknown user32.dll!74ec96d5() Unknown
Qt5Widgetsd.dll!642a88a6() Unknown
Qt5Widgetsd.dll!6429f820() Unknown Qt5Cored.dll!662b5eed() Unknown
Qt5Cored.dll!662b5eed() Unknown Qt5Widgetsd.dll!64384d57() Unknown
Qt5Widgetsd.dll!64253b6d() Unknown
Qt5Widgetsd.dll!64251cd5() Unknown
msvcr110d.dll!_heap_alloc_base(unsigned int size) Line 57 C
Qt5Widgetsd.dll!64235309() Unknown
Qt5Widgetsd.dll!64236cb7() Unknown
Qt5Widgetsd.dll!644f2e63() Unknown
Qt5Widgetsd.dll!644f0c32() Unknown Hooli.exe!ModalDialog::Run(bool
async) Line 195 C++ Qt5Cored.dll!6654df39() Unknown
Qt5Cored.dll!6654d981() Unknown Qt5Widgetsd.dll!6470d6da() Unknown
Qt5Widgetsd.dll!643a6df8() Unknown
Qt5Widgetsd.dll!643a6417() Unknown
Qt5Widgetsd.dll!643a5852() Unknown
Qt5Widgetsd.dll!6429f33d() Unknown
Qt5Widgetsd.dll!643a53b1() Unknown
Qt5Widgetsd.dll!6446703b() Unknown
Qt5Widgetsd.dll!64253b5e() Unknown
Qt5Widgetsd.dll!642505fb() Unknown Qt5Cored.dll!6650c2e4() Unknown
user32.dll!74ec8940() Unknown uxtheme.dll!70196e9f() Unknown
qwindowsd.dll!197447cc() Unknown Qt5Cored.dll!6650804c() Unknown
Qt5Cored.dll!66508252() Unknown Qt5Widgetsd.dll!644f0c45() Unknown
Qt5Cored.dll!662bcfbd() Unknown
Hooli.exe!ModalDialog::Run(bool async) Line 195 C++ Hooli.exe!Hooli::HomePage::PerformFileOperation(Hooli::HomePage::eFileOperation
operation) Line 727 C++ Hooli.exe!Hooli::HomePage::onCopy() Line
960 C++ Hooli.exe!Hooli::HomePage::qt_static_metacall(QObject * _o,
QMetaObject::Call _c, int _id, void * * _a) Line 242 C++
Edit 2: Here's the constructor for ModalDialog:
ModalDialog::ModalDialog( QWidget* pParent, const QString& rTitle, const QString& rDescription, eButtonWords words, eModalType type )
: QDialog( pParent, Qt::Dialog | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint ),
...
{
//We must have a parent to inherit the stylesheet
Q_ASSERT( pParent );
setModal( true );
setAttribute(Qt::WA_TranslucentBackground);
mpDialogBackground = new QWidget( this );
mpDialogBackground->setObjectName( "ModalBackground" );
mpTitle = new QLabel( rTitle, this );
mpTitle->setObjectName( "ModalTitle" );
mpTitle->setWordWrap( true );
mpTitle->setStyleSheet( QString("font: bold %1pt; ").arg(FONT_SIZE) );
switch( type )
{
case ModalType_ACTION_REQUIRED:
{
mpTitle->setProperty( "ModalType", "ActionRequired" );
}
break;
case ModalType_CONFIRM:
{
mpTitle->setProperty( "ModalType", "Confirm" );
}
break;
case ModalType_SUCCESS:
{
mpTitle->setProperty( "ModalType", "Success" );
}
break;
case ModalType_WARNING:
{
mpTitle->setProperty( "ModalType", "Warning" );
}
break;
case ModalType_FAILURE:
{
mpTitle->setProperty( "ModalType", "Failure" );
}
break;
case ModalType_DEFAULT:
default:
//do nothing
break;
}
mpIconLabel = new QLabel( this );
mpDescription = new QLabel( rDescription, this );
mpDescription->setObjectName( "ModalDescription" );
mpDescription->setWordWrap( true );
mpDescription->setStyleSheet( QString("font: %1pt;").arg(FONT_SIZE) );
mpButtonArea = new QWidget( this );
mpButtonArea->setObjectName( "ModalButtonArea" );
mpOkButton = new QPushButton( this );
mpOkButton->resize( DEFAULT_BUTTON_WIDTH, DEFAULT_BUTTON_HEIGHT );
connect( mpOkButton, SIGNAL( released() ), this, SLOT( OnYesOk() ) );
mpCancelButton = new QPushButton( this );
mpCancelButton->resize( DEFAULT_BUTTON_WIDTH, DEFAULT_BUTTON_HEIGHT );
connect( mpCancelButton, SIGNAL( released() ), this, SLOT( OnNoCancel() ) );
mpSpecialCancelButton = new QPushButton( this );
mpSpecialCancelButton->resize( DEFAULT_BUTTON_WIDTH, DEFAULT_BUTTON_HEIGHT );
connect( mpSpecialCancelButton, SIGNAL( released() ), this, SLOT( OnSpecialCancel() ) );
mpSpecialCancelButton->hide();
setPixmapBackground( GuiCommon::cPixmap( ":/mypixmap.png" ), true );
SetButtonStrings( mOkText, mCancelText, mYesText, mNoText );
//The actual widget size is the size of the window because
//a semi-transparent cover is put over the background.
setFixedSize( WIDTH, HEIGHT );
SetSize( DEFAULT_POPUP_WIDTH, DEFAULT_POPUP_HEIGHT );
}
Related
right now, I'm learning Perl 6; my first project is to make an HTTP client .. I get an error and I do not understand why
Malformed UTF-8 at line 1 col 45
in method new at main.p6 line 13
in block <unit> at main.p6 line 43
I think it comes from the port variable, but I'm not sure
Here is all of my perl6 code:
class Request
{
has $!method;
has $!path;
has $!version;
has #!headers;
has $!socket;
has $.response is rw;
method new(:$method, :$path, :$host, :$port, :$version = "HTTP/1.1")
{
my $socket = IO::Socket::INET.new(:$host, :$port);
return self.bless(:$method, :$path, :$version, :$socket);
}
submethod BUILD(:$!method, :$!path, :$!version, :$!socket){}
method setHeader($name, $value)
{
my %header = name => $name, value => $value;
#!headers.push({%header});
}
method toString
{
my $request = "$!method $!path $!version\r\n";
for #!headers -> %_ {
$request ~= %_{'name'} ~ ": " ~ %_{'value'} ~ "\r\n";
}
$request ~ "\r\n";
}
method send($i = 1)
{
say "Request send!";
$!socket.print($.toString());
say $!socket.recv for 0..$i;
}
}
my $host = "127.0.0.1";
my Int $port = 58002;
my $request = Request.new(:method("GET"), :path("/"), :$host, :$port);
$request.setHeader("host", $host);
$request.setHeader("Accept-Language", "fr");
$request.send(2);
This answer may not be helpful, might be annoying, but I can delete it later today if it was and it's all I've got and I have to run.
I don't know if you understand the error message, but let's cover that first.
Malformed UTF-8 at line 1 col 45
in method new at main.p6 line 13
in block <unit> at main.p6 line 43
This means that during execution of the last line in the message, line 43 of your code, something went wrong:
my $request = Request.new(:method("GET"), :path("/"), :$host, :$port);
The compiler noticed that execution of that last line involved a path that went through another line in your code, line 13:
return self.bless(:$method, :$path, :$version, :$socket);
So that helps better pinpoint the line during execution of which the error occurred.
.bless is a method call. It's called on self which refers to the invocant passed to the method which you can assume is an object of the class in which the method call appears, namely the class you're defining Request.
Your code doesn't specify what class Request inherits from (using is) so it inherits from Any. The bless for Any is inherited from Mu's.
which is this code in the Rakudo compiler:
method bless(*%attrinit) {
nqp::create(self).BUILDALL(Empty, %attrinit);
}
So during execution of that code, Perl 6 attempted to read some UTF8 and encountered an invalid character at col 45 of the very first line of some data it tried to read.
So that's the best I can say about why, without seeing your data.
I want to call QNetworkReply::readAll as shown in Foo() such that once it completes, another time it should be called.
QString Foo (QString& requestUrl)
{
QNetworkReply *pReply = NetManager::getManager()->get(requestUrl,NULL,NULL);
QEventLoop loop;
QObject::connect(pReply,SIGNAL(finished()),&loop,SLOT(quit()));
loop.exec();
return pReply->readAll();
}
I want this because my Qt Gui application crashed with 0xC00000FD: Stack overflow exception. and in callstack, I got repeated calling of functions as shown in below callstack.
I don't understand that despite of using QEventLoop to make call to readAll() synchronous, how recursion is possible.
My Gui application is used by user to click and initiate readAll().
Is there a way to prevent the crash?
MyUtility.dll!Class::Function(l) Line abc C++
Qt5Core.dll!0000000052b0991c() Unknown
Qt5Widgets.dll!0000000056ff9d9a() Unknown
Qt5Widgets.dll!0000000056ffb4ff() Unknown
Qt5Widgets.dll!00000000570e8c57() Unknown
Qt5Core.dll!0000000052aeb905() Unknown
Qt5Widgets.dll!0000000056fd4ff2() Unknown
Qt5Widgets.dll!0000000056fd35a6() Unknown
Qt5Core.dll!0000000052ae9aea() Unknown
Qt5Widgets.dll!0000000057021e95() Unknown
Qt5Widgets.dll!00000000570204ee() Unknown
Qt5Widgets.dll!0000000056fd5006() Unknown
Qt5Widgets.dll!0000000056fd4623() Unknown
Qt5Core.dll!0000000052ae9aea() Unknown
Qt5Gui.dll!000007fededd3c52() Unknown
Qt5Gui.dll!000007fededd5f67() Unknown
Qt5Gui.dll!000007fededc379e() Unknown
Qt5Core.dll!0000000052b2e6c5() Unknown
user32.dll!UserCallWinProcCheckWow() Unknown
user32.dll!DispatchMessageWorker() Unknown
Qt5Core.dll!0000000052b2ddfc() Unknown
qwindows.dll!000007fedd1df491() Unknown
Qt5Core.dll!0000000052ae6c61() Unknown
MyUtility.dll!Class::Function(l) Line abc C++
Qt5Core.dll!0000000052b0991c() Unknown
Qt5Widgets.dll!0000000056ff9d9a() Unknown
Qt5Widgets.dll!0000000056ffb4ff() Unknown
Qt5Widgets.dll!00000000570e8c57() Unknown
Qt5Core.dll!0000000052aeb905() Unknown
Qt5Widgets.dll!0000000056fd4ff2() Unknown
Qt5Widgets.dll!0000000056fd35a6() Unknown
Qt5Core.dll!0000000052ae9aea() Unknown
Qt5Widgets.dll!0000000057021e95() Unknown
Qt5Widgets.dll!00000000570204ee() Unknown
Qt5Widgets.dll!0000000056fd5006() Unknown
Qt5Widgets.dll!0000000056fd4623() Unknown
Qt5Core.dll!0000000052ae9aea() Unknown
Qt5Gui.dll!000007fededd3c52() Unknown
Qt5Gui.dll!000007fededd5f67() Unknown
Qt5Gui.dll!000007fededc379e() Unknown
Qt5Core.dll!0000000052b2e6c5() Unknown
user32.dll!UserCallWinProcCheckWow() Unknown
user32.dll!DispatchMessageWorker() Unknown
Qt5Core.dll!0000000052b2ddfc() Unknown
qwindows.dll!000007fedd1df491() Unknown
Qt5Core.dll!0000000052ae6c61() Unknown
Qt5Core.dll!0000000052ae8d39() Unknown
MyUtility.exe!main(int argc, char * * argv) Line abc C++
MyUtility.exe!WinMain() C++
I've got a custom source that seams to work with a simple topology. When QueryInterface gets called the stack looks like this:
MySource.dll!MySource::QueryInterface(const _GUID & riid, void * * ppv) Line 83 C++
mfcore.dll!CMediaEventPtr::GetUnknown(struct IMFMediaEvent *,struct _GUID const &,void * *) Unknown
mfcore.dll!CMPSourceManager::OnNewStream() Unknown
mfcore.dll!CMPSourceManager::OnSourceEvent() Unknown
mfcore.dll!CMPSourceManager::OnSourceEventAsyncCallback::Invoke(struct IMFAsyncResult *) Unknown
Using the same custom source without a topology, letting IMFCaptureEngine deal with that. When QueryInterface gets called the stack looks like this:
MySource.dll!MySource::QueryInterface(const _GUID & riid, void * * ppv) Line 42 C++
mfcore.dll!CMediaEventPtr::GetUnknown(struct IMFMediaEvent *,struct _GUID const &,void * *) Unknown
mfcore.dll!CSeqSourceWrap::HandleUpdatedStream(struct IMFMediaEvent *) Unknown
mfcore.dll!CSeqSourceWrap::OnSourceEvent() Unknown
mfcore.dll!CSeqSourceWrap::OnSourceEventAsyncCallback::Invoke(struct IMFAsyncResult *) Unknown
In the topo case, I then get a call to GetStreamDescriptor and RequestSample and everything works.
MySourceCPP_COM.dll!MyStream::GetStreamDescriptor(IMFStreamDescriptor * * ppStreamDescriptor) Line 187 C++
mfcore.dll!CMPSourceManager::OnNewStream() Unknown
mfcore.dll!CMPSourceManager::OnSourceEvent() Unknown
mfcore.dll!CMPSourceManager::OnSourceEventAsyncCallback::Invoke(struct IMFAsyncResult *) Unknown
MySourceCPP_COM.dll!MyStream::RequestSample(IUnknown * pToken) Line 208 C++
mfcore.dll!CMPSourceNodeInfo::RequestSample() Unknown
mfcore.dll!CMPSourceNodeInfo::GenerateData() Unknown
mfcore.dll!CMPSourceNodeInfo::ProcessSample() Unknown
mfcore.dll!CMPWalker::ProcessCommands() Unknown
mfcore.dll!CMFMediaProcessor::ProcessSample() Unknown
mfcore.dll!CMFMediaProcessorStream::_RequestSample() Unknown
mfcore.dll!CMFMediaProcessorStream::RequestSample(struct IUnknown *) Unknown
mfcore.dll!CBitPump::HandleSinkRequestSample() Unknown
mfcore.dll!CBitPump::OnSinkEvent() Unknown
mfcore.dll!CBitPump::OnSinkEventAsyncCallback::Invoke(struct IMFAsyncResult *) Unknown
In the IMFCaptureEngine case I never get either call so data never flows.
I see the only difference is CMPSourceManager vs. CSeqSourceWrap.
I'm trying to make a service mock:
$this->mocker->mockService(
'manager.mikrotik',
new AtoumAdapter(
'\MyBundle\Services\MikrotikManager'
)
);
I get this error:
Warning: Missing argument 1 for
mock\MyBundle\Services\MikrotikManager::__construct(), called in
vendor/rezzza/mock-extension/src/Adapter/AtoumAdapter.php on line 45
and defined in vendor/atoum/atoum/classes/mock/generator.php(183) :
eval()'d code line 22
Where is my mistake?
Now I resolve using orphanize:
$this
->mocker
->mockService(
'manager.mikrotik',
new AtoumAdapter(
'\MyBundle\Services\MikrotikManager',
function ($generator) {
$generator->orphanize('__construct');
}
)
);
Here class __construct:
public function __construct($em,$mikrotikIp, $mikrotikUser, $mikrotikPassword)
I'm trying to add the edit form of an existing node to a Basic page. Based on a given nid.
This problem seemed simple, however my attempt resulted in the following error report:
$node = node_load(array('nid' => 83));
$output = drupal_get_form($node->type .'_node_form', $node);
echo $output;
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 175 of /home/PAE/www/paemanu/includes/entity.inc).
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->cacheGet() (line 388 of /home/PAE/www/paemanu/includes/entity.inc).
Notice: Trying to get property of non-object in eval() (line 3 of /home/PAE/www/paemanu/modules/php/php.module(80) : eval()'d code).
Notice: Undefined index: _node_form in drupal_retrieve_form() (line 806 of /home/PAE/www/paemanu/includes/form.inc).
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function '_node_form' not found or invalid function name in drupal_retrieve_form() (line 841 of /home/PAE/www/paemanu/includes/form.inc).
Notice: Undefined variable: output in eval() (line 3 of /home/PAE/www/paemanu/modules/php/php.module(80) : eval()'d code).
Notice: Undefined index: user-project in drupal_retrieve_form() (line 806 of /home/PAE/www/paemanu/includes/form.inc).
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'user-project' not found or invalid function name in drupal_retrieve_form() (line 841 of /home/PAE/www/paemanu/includes/form.inc).
I've been on this issue for many hours, any help is greatly appreciated.
Try this code:
$nid = 83;
$node = node_load($nid);
$type = $node->type;
module_load_include('inc', 'node', 'node.pages');
$form = drupal_get_form('node_edit_'.$type, $node);
render($form);