reuse a gtk_file_chooser_dialog multiple times - gtk3

I'd like to re-use a gtk_file_chooser_dialog multiple times. But after the user closes the dialog the first time, the pointer to the GtkFileChooserDialog struct seems broken.
Opening the diaglog the first time succeeds.
Opening the same dialog a second time results in
(crystal_facet_uml:3797): GLib-GObject-WARNING **: invalid unclassed pointer in cast to 'GtkWidget'
(crystal_facet_uml:3797): Gtk-CRITICAL **: gtk_widget_show_all: assertion 'GTK_IS_WIDGET (widget)' failed
My first idea was to increase the reference counter on the dialog to prevent it from being cleaed up:
(*this_).use_db_file_chooser = gtk_file_chooser_dialog_new ( "Select DB to use",
GTK_WINDOW( (*this_).window ),
GTK_FILE_CHOOSER_ACTION_SAVE,
"Cancel",
GTK_RESPONSE_CANCEL,
"Create/Use DB-File",
GTK_RESPONSE_ACCEPT,
NULL
);
g_object_ref( (*this_).use_db_file_chooser );
... but this only shifts the problem: the dialog-window seems to stay but the contained widgets are gone:
(crystal_facet_uml:3797): Gtk-CRITICAL **: gtk_container_foreach: assertion 'GTK_IS_CONTAINER (container)' failed
(crystal_facet_uml:3797): Gtk-CRITICAL **: gtk_container_foreach: assertion 'GTK_IS_CONTAINER (container)' failed
(crystal_facet_uml:3797): Gtk-CRITICAL **: gtk_container_foreach: assertion 'GTK_IS_CONTAINER (container)' failed
(crystal_facet_uml:3797): Gtk-CRITICAL **: gtk_container_foreach: assertion 'GTK_IS_CONTAINER (container)' failed
(crystal_facet_uml:3797): Gtk-CRITICAL **: _gtk_file_chooser_embed_initial_focus: assertion 'GTK_IS_FILE_CHOOSER_EMBED (chooser_embed)' failed
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
(crystal_facet_uml:3797): Gtk-CRITICAL **: gtk_container_foreach: assertion 'GTK_IS_CONTAINER (container)' failed
Do you have an idea how to do this right?
(Rationale for re-using the file chooser dialogs are: 1) I want to allocate it in the beginning and afterwards not care about NULL-pointers anymore, 2) I want to keep the contents of the dialog (current folder, current filename), 3) I want to start this non-modal dialog only once, never 2 dialogs at the same time, 4) I want to keep the g_signal bindings throughout the lifetime of my program).
(full source code: https://sourceforge.net/p/crystal-facet-uml/code/ci/46ee183ea06baae3af70d81c74efe767fccc5028/tree/gui/source/gui_main_window.c )

I found a nice solution (with the help of the answer to C GTK can't open Dialog again after closing via ESC and the documentation on https://developer.gnome.org/gtk3/stable/GtkWidget.html#GtkWidget-delete-event ):
simply connect the delete-event of the dialog to the gtk-predefined callback function gtk_widget_hide_on_delete():
g_signal_connect( G_OBJECT((*this_).use_db_file_chooser), "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), NULL );
And your dialog-object is not destroyed when the user closes it.

Related

Unexpected error in flutter without any errors

Im getting this unexpected error without changed in the code and no error being pointed
Exception caught by scheduler library ═════════════════════════════════
'package:flutter/src/widgets/binding.dart': Failed assertion: line 849 pos 12: '!debugBuildingDirtyElements': is not true.
Any idea what is it?

Fatal Exception: java.lang.RuntimeException: Unable to destroy activity {com.example.app.MainActivity}: java.lang.IllegalArgumentException:

My flutter application keeps on crashing and logging this error on firebase crash analytics
Fatal Exception: java.lang.RuntimeException: Unable to destroy activity {com.aims.covidsurvey/com.example.app.MainActivity}: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter activity
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4463)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4482)
at android.app.ActivityThread.-wrap6(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1640)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6617)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)
Have tried to debug the app, am not getting much information what is causing the error, anyone know what could be causing this and how to fix it? Have tried to research am not getting much information
the Kotlin code generated by the app
package com.example.app
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() {
}
And another crash error
Caused by java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter activity
at com.lyokone.location.FlutterLocationService.setActivity(FlutterLocationService.kt)
at com.lyokone.location.LocationPlugin.deinitialize(LocationPlugin.java:121)
at com.lyokone.location.LocationPlugin.detachActivity(LocationPlugin.java:56)
at com.lyokone.location.LocationPlugin.onDetachedFromActivity(LocationPlugin.java:69)
at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.detachFromActivity(FlutterEngineConnectionRegistry.java:389)
at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onDetach(FlutterActivityAndFragmentDelegate.java:556)
at io.flutter.embedding.android.FlutterActivity.release(FlutterActivity.java:587)
at io.flutter.embedding.android.FlutterActivity.onDestroy(FlutterActivity.java:608)
at android.app.Activity.performDestroy(Activity.java:7136)
at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1158)
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4450)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4482)
at android.app.ActivityThread.-wrap6(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1640)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6617)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)
My solution was to change the component location to geolocator
https://pub.dev/packages/geolocator

Hosting internal Nuget and Symbols server

I have setup the Nuget.Server and the SymbolSource Server Basic in one solution when I run the "self diagnostics tool" I get the following exception, anyone have a clue what this is?
The URL I am accessing is
http://localhost/Home/NuGetPushTest
Method not found: 'Void NuGet.PackageServer.PushPackage(System.String,
System.IO.Stream, Int32)'.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.MissingMethodException: Method not found:
'Void NuGet.PackageServer.PushPackage(System.String, System.IO.Stream,
Int32)'.
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.

NUnit.ConsoleRunner.Runner "System.Security.SecurityException: That assembly does not allow partially trusted callers"

nunit-console.exe throws the following error while i tried to execute from Mapped Network Drive
Unhandled Exception: System.TypeInitializationException: The type initializer for 'NUnit.ConsoleRunner.Runner' threw an exception. ---> System.Security.SecurityException: That assembly does not allow partially trusted callers.
at NUnit.ConsoleRunner.Runner..cctor()
The action that failed was:
LinkDemand
The assembly or AppDomain that failed was:
nunit-console-runner, Version=2.6.3.13283, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77
The method that caused the failure was:
NUnit.Core.Logger GetLogger(System.Type)
The Zone of the assembly that failed was:
Internet
The Url of the assembly that failed was:
file:///Z:/jenkinsworkspace/workspace/FlashUpload/tools/NUnit/lib/nunit-console-runner.DLL
--- End of inner exception stack trace ---
at NUnit.ConsoleRunner.Runner.Main(String[] args)
at NUnit.ConsoleRunner.Class1.Main(String[] args)**
I tried adding loadFromRemoteSources enabled="true" in nunit-console.exe.config, but that did not solve the problem.
Add this to the nunit-console.config file.
<supportedRuntime version="v4.0"/>
Got this from here:
Get .NET to consider a specific network share to be fully trusted:

What is a Boxed Error in Scala?

When I run my application, the browser shows
[ExecutionException: Boxed Error]
It doesn't say anything about the line number, etc.
In the console, I have the following
! #6elaah0c8 - Internal server error, for (GET) [/testlearn] ->
play.api.Application$$anon$1: Execution exception[[ExecutionException: Boxed Error]]
at play.api.Application$class.handleError(Application.scala:289) ~[play_2.10.jar:2.1.1]
at play.api.DefaultApplication.handleError(Application.scala:383) [play_2.10.jar:2.1.1]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$17$$anonfun$apply$24.apply(PlayDefaultUpstreamHandler.scala:326) [play_2.10.jar:2.1.1]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$17$$anonfun$apply$24.apply(PlayDefaultUpstreamHandler.scala:324) [play_2.10.jar:2.1.1]
at play.api.libs.concurrent.PlayPromise$$anonfun$extend1$1.apply(Promise.scala:113) [play_2.10.jar:2.1.1]
at play.api.libs.concurrent.PlayPromise$$anonfun$extend1$1.apply(Promise.scala:113) [play_2.10.jar:2.1.1]
java.util.concurrent.ExecutionException: Boxed Error
at scala.concurrent.impl.Promise$.resolver(Promise.scala:52) ~[factorie-1.0.0-M4-jar-with-dependencies.jar:na]
at scala.concurrent.impl.Promise$.scala$concurrent$impl$Promise$$resolveTry(Promise.scala:44) ~[factorie-1.0.0-M4-jar-with-dependencies.jar:na]
at scala.concurrent.impl.Promise$DefaultPromise.tryComplete(Promise.scala:116) ~[factorie-1.0.0-M4-jar-with-dependencies.jar:na]
at scala.concurrent.Promise$class.complete(Promise.scala:55) ~[factorie-1.0.0-M4-jar-with-dependencies.jar:na]
at scala.concurrent.impl.Promise$DefaultPromise.complete(Promise.scala:58) ~[factorie-1.0.0-M4-jar-with-dependencies.jar:na]
at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:23) [factorie-1.0.0-M4-jar-with-dependencies.jar:na]
Caused by: java.lang.AssertionError: assertion failed
at scala.Predef$.assert(Predef.scala:165) ~[factorie-1.0.0-M4-jar-with-dependencies.jar:na]
at cc.factorie.util.TraversableExtras$class.max2ByDouble(TraversableExtras.scala:95) ~[factorie-1.0.0-M4-jar-with-dependencies.jar:na]
at cc.factorie.package$$anon$2.max2ByDouble(package.scala:148) ~[factorie-1.0.0-M4-jar-with-dependencies.jar:na]
at cc.factorie.optimize.SampleRankExample.accumulateExampleInto(SampleRank.scala:31) ~[factorie-1.0.0-M4-jar-with-dependencies.jar:na]
at cc.factorie.optimize.OnlineTrainer$$anonfun$processExamples$3.apply(Trainer.scala:72) ~[factorie-1.0.0-M4-jar-with-dependencies.jar:na]
at cc.factorie.optimize.OnlineTrainer$$anonfun$processExamples$3.apply(Trainer.scala:63) ~[factorie-1.0.0-M4-jar-with-dependencies.jar:na]
"Boxed Error" is Scala's response to an Error being thrown within a Future. In Java, and hence Scala, subclasses of type Error have a special meaning as Fatal errors. See Differences between Exception and Error. In short, the javadoc says:
An Error is a subclass of Throwable that indicates serious problems
that a reasonable application should not try to catch. Most such
errors are abnormal conditions.
Unlike throwing other Throwables within a future, when a subclass of Error is thrown, the default Scala resolver will wrap up the Error in a java.util.concurrent.ExecutionException, with the message string "Boxed Error", and complete your promise with a failure.
To quote the futures documentation http://docs.scala-lang.org/overviews/core/futures.html w.r.t. Error being thrown:
[Error] exceptions are rethrown in the thread executing the failed
asynchronous computation. The rationale behind this is to prevent
propagation of critical and control-flow related exceptions normally
not handled by the client code and at the same time inform the client
in which future the computation failed.
If you want to do something special with the Failure, the original Error that was thrown can be extracted (but not in a way particularly amenable to pattern matching), by ExecutionException#getCause()
I don't know that's a Boxed Error, but according to your stacktrace, the root problem comes from the factorie lib, from the max2Double method at line 95.
Extract from the source code:
/**Returns both the maximum element and the second-to-max element */
def max2ByDouble(extractor: A => Double): (A, A) = {
val s1 = t.toSeq
assert(s1.length > 1) // <<<== HERE
var best1 = Double.NegativeInfinity
...
It seems that your Traversable is empty.